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

:root {
    --bg: #ecddd2;
    --bg-card: #f5e9de;
    --accent: #f04e2a;
    --accent-hover: #d43d1c;
    --text: #1c1410;
    --text-muted: #7a6a5e;
    --border: rgba(0, 0, 0, 0.09);
    --surface-hover: rgba(0, 0, 0, 0.05);
    --surface-input: rgba(0, 0, 0, 0.04);
    --border-hover: rgba(0, 0, 0, 0.2);
    --spinner-ring: rgba(0, 0, 0, 0.1);
    --header-bg: rgba(236, 221, 210, 0.92);
    --logo-from: #1c1410;
    --chart-day-fill: rgba(0, 0, 0, 0.35);
    --chart-val-fill: rgba(0, 0, 0, 0.5);
    --toast-bg: #f5e9de;
    --toast-color: #1c1410;
    --toast-border: rgba(0, 0, 0, 0.1);
    --select-option-bg: #f5e9de;
    --loading-overlay: rgba(236, 221, 210, 0.6);
    --balance-color: #8a6000;
    --balance-bg: rgba(138, 96, 0, 0.10);
    --balance-border: rgba(138, 96, 0, 0.28);
    --bonus-color: #1a7a48;
    --bonus-bg: rgba(26, 122, 72, 0.10);
    --bonus-border: rgba(26, 122, 72, 0.28);
}

[data-theme="dark"] {
    --bg: #0c0b0a;
    --bg-card: #181614;
    --text: #f5f4f2;
    --text-muted: #8a8680;
    --border: rgba(255, 255, 255, 0.08);
    --surface-hover: rgb(255 255 255 / 0.06);
    --surface-input: rgb(255 255 255 / 0.04);
    --border-hover: rgb(255 255 255 / 0.2);
    --spinner-ring: rgb(255 255 255 / 0.1);
    --header-bg: rgba(12, 11, 10, 0.85);
    --logo-from: #ffffff;
    --chart-day-fill: rgba(255, 255, 255, 0.28);
    --chart-val-fill: rgba(255, 255, 255, 0.5);
    --toast-bg: #1a1612;
    --toast-color: #ffffff;
    --toast-border: rgb(255 255 255 / 0.1);
    --select-option-bg: #181614;
    --loading-overlay: rgba(12, 11, 10, 0.6);
    --balance-color: #F0C040;
    --balance-bg: rgba(240, 192, 64, 0.08);
    --balance-border: rgba(240, 192, 64, 0.22);
    --bonus-color: #3cad6e;
    --bonus-bg: rgba(72, 199, 116, 0.08);
    --bonus-border: rgba(72, 199, 116, 0.25);
}

.btn-icon-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.btn-icon-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.hidden { display: none !important; }

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 48px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--logo-from) 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    cursor: pointer;
}

.nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(240, 78, 42, 0.4);
}

.btn-primary:disabled {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: not-allowed;
    opacity: 1;
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
    border-radius: 12px;
}

/* Service nav */
.service-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 0 24px;
}

.service-nav-item {
    position: relative;
}

.service-nav-btn {
    display: inline-block;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.service-nav-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.dropdown:hover .dropdown-menu {
    display: flex;
}

.dropdown-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    padding-top: 12px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.dropdown-item:hover {
    color: var(--text);
    background: var(--surface-hover);
}

/* Hero */
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(240, 78, 42, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 640px;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.user-name {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--balance-bg);
    border: 1px solid var(--balance-border);
    border-radius: 20px;
    padding: 5px 14px 5px 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--balance-color);
}

.balance-chip--bonus {
    background: var(--bonus-bg);
    border-color: var(--bonus-border);
    color: var(--bonus-color);
}

.balance-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 40px;
    margin-bottom: 28px;
}

.balance-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.balance-amount {
    font-size: 2rem;
    font-weight: 700;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.18s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px 36px;
    width: min(420px, 92vw);
    position: relative;
    animation: slideUp 0.22s ease;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.modal-step.hidden { display: none; }

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* Social buttons (full width, stacked) */
.btn-social {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px;
    border-radius: 12px;
    font-size: 0.97rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.15s;
    border: none;
}

.btn-social:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.social-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-social-tg {
    background: #2AABEE;
    color: #fff;
}

.btn-social-yandex {
    background: #FC3F1D;
    color: #fff;
}

.btn-social-vk {
    background: #0077FF;
    color: #fff;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Email password button */
.btn-email-password {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.btn-email-password:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* QR code area */
#qr-code {
    display: flex;
    justify-content: center;
    margin: 4px 0 20px;
}

#qr-code img,
#qr-code canvas {
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    display: block;
}

.modal-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 18px;
}

.modal-hint strong {
    color: var(--text);
}

/* Polling status */
.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--spinner-ring);
    border-top-color: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
    animation: spin 0.75s linear infinite;
}

/* Success step */
.success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

/* ── Modal email section ── */

.modal-form-group {
    margin-bottom: 12px;
}

.modal-form-group input {
    width: 100%;
    padding: 10px 13px;
    background: var(--surface-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s;
}

.modal-form-group input:focus {
    border-color: var(--accent);
}

.modal-form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.btn-back {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s;
}

.btn-back:hover {
    color: var(--text);
}

#email-error {
    margin-bottom: 10px;
    padding: 10px 12px;
    font-size: 0.82rem;
}

/* ── Auth pages (register, login) ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(240, 78, 42, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.auth-logo {
    position: fixed;
    top: 24px;
    left: 48px;
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg, var(--logo-from) 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px;
    width: min(420px, 100%);
    position: relative;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
    padding: 13px;
    font-size: 1rem;
}

.auth-footer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 20px;
}

.otp-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0 24px;
}

.otp-input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 600;
    background: var(--surface-input);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    caret-color: var(--accent);
}

.otp-input:focus {
    border-color: var(--accent);
    background: rgba(240, 78, 42, 0.06);
}

.otp-input.filled {
    border-color: rgba(240, 78, 42, 0.5);
}

.verify-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

.auth-link {
    color: var(--accent);
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

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

/* ── Generate page ── */
.generate-page {
    overflow: hidden;
}

.generate-layout {
    display: flex;
    height: calc(100vh - 61px);
}

.generate-sidebar {
    width: 460px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.sidebar-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(240, 78, 42, 0.18);
    color: var(--accent);
    border: 1px solid rgba(240, 78, 42, 0.3);
}

.gen-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.model-block {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.model-block.hidden {
    display: none;
}

.gen-form__section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-clear-field {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.4;
}

.btn-clear-field:hover {
    opacity: 1;
    background: var(--surface-hover);
}

.param-required {
    color: var(--accent);
    margin-left: 2px;
}

.param-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
    line-height: 1.5;
}

.param-textarea:focus {
    border-color: var(--accent);
}

.param-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
}

.param-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s;
}

.param-input:focus {
    border-color: var(--accent);
}

.param-input::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
}

/* Format toggle */
.btn-toggle-group {
    display: flex;
    gap: 6px;
}

.btn-toggle {
    flex: 1;
    padding: 7px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-toggle.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-toggle:not(.active):hover {
    border-color: var(--border-hover);
    color: var(--text);
}

/* Size buttons */
.btn-size-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-size {
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-size.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-size:not(.active):hover {
    border-color: var(--border-hover);
    color: var(--text);
}

.generate-action {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.btn-generate {
    flex: 1;
    padding: 13px;
    font-size: 1rem;
}

.gen-cost {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--balance-color);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Preview area */
.generate-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    opacity: 0.4;
    user-select: none;
}

.preview-placeholder p {
    font-size: 0.9rem;
}

.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    color: var(--text-muted);
    overflow: hidden;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.preview-actions {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 6px;
    padding: 5px;
    background: rgba(10,10,10,0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    white-space: nowrap;
}

/* ── Upload zone ── */
.param-hint {
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.78rem;
    margin-left: 4px;
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
}

.upload-zone:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(240, 78, 42, 0.04);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(240, 78, 42, 0.08);
    color: var(--text);
}

.upload-zone.upload-zone-full {
    opacity: 0.4;
    pointer-events: none;
}

.upload-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-loading img {
    opacity: 0.4;
}

.thumb-spinner {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
}

.thumb-loading .thumb-spinner {
    display: flex;
}

.thumb-loading .thumb-spinner::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    border: none;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.thumb:hover .thumb-remove {
    opacity: 1;
}

/* ── AI Loader ────────────────────────────────────────── */

.gen-aurora {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.gen-aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0;
    animation: aurora-drift 9s ease-in-out infinite;
}

.gen-aurora-blob--1 {
    width: 55%; height: 60%;
    background: radial-gradient(circle, #e64e1e, transparent 70%);
    top: -10%; left: -5%;
    animation-delay: 0s;
}

.gen-aurora-blob--2 {
    width: 50%; height: 55%;
    background: radial-gradient(circle, #c73218, transparent 70%);
    bottom: -10%; right: -5%;
    animation-delay: -3.5s;
}

.gen-aurora-blob--3 {
    width: 45%; height: 50%;
    background: radial-gradient(circle, #f8944a, transparent 70%);
    top: 20%; right: 10%;
    animation-delay: -6s;
}

@keyframes aurora-drift {
    0%, 100% { transform: translate(0, 0) scale(1);     opacity: 0.25; }
    33%       { transform: translate(25px, -20px) scale(1.15); opacity: 0.4;  }
    66%       { transform: translate(-15px, 25px) scale(0.9);  opacity: 0.2;  }
}

.ai-loader {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    flex-shrink: 0;
}

/* Rings */
.ai-loader__ring {
    position: absolute;
    top: 50%; left: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.ai-loader__ring--outer {
    width: 290px; height: 290px;
    background: conic-gradient(
        from 0deg,
        rgba(240, 78, 42, 0)    0%,
        rgba(240, 78, 42, 0.85) 25%,
        rgba(200, 50, 20, 0.4)  55%,
        rgba(240, 78, 42, 0)    100%
    );
    -webkit-mask: radial-gradient(circle, transparent calc(50% - 1px),   black calc(50% - 1px)   calc(50% + 1px),   transparent calc(50% + 1px));
    mask:         radial-gradient(circle, transparent calc(50% - 1px),   black calc(50% - 1px)   calc(50% + 1px),   transparent calc(50% + 1px));
    animation: spin 10s linear infinite;
}

.ai-loader__ring--mid {
    width: 218px; height: 218px;
    background: conic-gradient(
        from 180deg,
        rgba(248, 148, 74, 0)    0%,
        rgba(248, 148, 74, 0.95) 28%,
        rgba(240, 78, 42, 0.5)   58%,
        rgba(248, 148, 74, 0)    100%
    );
    -webkit-mask: radial-gradient(circle, transparent calc(50% - 1.5px), black calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px));
    mask:         radial-gradient(circle, transparent calc(50% - 1.5px), black calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px));
    animation: spin-reverse 5s linear infinite;
}

.ai-loader__ring--inner {
    width: 156px; height: 156px;
    background: conic-gradient(
        from 90deg,
        rgba(200, 50, 20, 0)     0%,
        rgba(200, 50, 20, 1)     20%,
        rgba(240, 78, 42, 0.55)  48%,
        rgba(200, 50, 20, 0)     100%
    );
    -webkit-mask: radial-gradient(circle, transparent calc(50% - 2px),   black calc(50% - 2px)   calc(50% + 2px),   transparent calc(50% + 2px));
    mask:         radial-gradient(circle, transparent calc(50% - 2px),   black calc(50% - 2px)   calc(50% + 2px),   transparent calc(50% + 2px));
    animation: spin 3s linear infinite;
}

/* Particles */
.ai-loader__pts {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
}

.ai-loader__pts span {
    position: absolute;
    border-radius: 50%;
}

.ai-loader__pts--inner {
    animation: spin 5s linear infinite;
}

.ai-loader__pts--inner span {
    width: 6px; height: 6px;
    margin: -3px 0 0 -3px;
    background: #f8944a;
    box-shadow: 0 0 8px 3px rgba(248, 148, 74, 0.9);
}

.ai-loader__pts--inner span:nth-child(1) { transform: rotate(0deg)   translateX(78px); }
.ai-loader__pts--inner span:nth-child(2) { transform: rotate(45deg)  translateX(78px); }
.ai-loader__pts--inner span:nth-child(3) { transform: rotate(90deg)  translateX(78px); }
.ai-loader__pts--inner span:nth-child(4) { transform: rotate(135deg) translateX(78px); }
.ai-loader__pts--inner span:nth-child(5) { transform: rotate(180deg) translateX(78px); }
.ai-loader__pts--inner span:nth-child(6) { transform: rotate(225deg) translateX(78px); }
.ai-loader__pts--inner span:nth-child(7) { transform: rotate(270deg) translateX(78px); }
.ai-loader__pts--inner span:nth-child(8) { transform: rotate(315deg) translateX(78px); }

.ai-loader__pts--outer {
    animation: spin-reverse 8s linear infinite;
}

.ai-loader__pts--outer span {
    width: 5px; height: 5px;
    margin: -2.5px 0 0 -2.5px;
    background: #fbbf7a;
    box-shadow: 0 0 7px 2px rgba(251, 191, 122, 0.85);
}

.ai-loader__pts--outer span:nth-child(1) { transform: rotate(0deg)   translateX(145px); }
.ai-loader__pts--outer span:nth-child(2) { transform: rotate(72deg)  translateX(145px); }
.ai-loader__pts--outer span:nth-child(3) { transform: rotate(144deg) translateX(145px); }
.ai-loader__pts--outer span:nth-child(4) { transform: rotate(216deg) translateX(145px); }
.ai-loader__pts--outer span:nth-child(5) { transform: rotate(288deg) translateX(145px); }

/* Core orb */
.ai-loader__core {
    position: relative;
    width: 96px; height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f04e2a 0%, #c73218 40%, #f8944a 80%, #f04e2a 100%);
    background-size: 200% 200%;
    animation: blob-morph 7s ease-in-out infinite, gradient-shift 4s ease-in-out infinite, core-glow 3s ease-in-out infinite alternate;
    z-index: 2;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes spin-reverse {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(-360deg); }
}

@keyframes blob-morph {
    0%,  100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    20%        { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    40%        { border-radius: 50% 40% 60% 30% / 30% 50% 70% 40%; }
    60%        { border-radius: 40% 60% 30% 70% / 60% 40% 50% 60%; }
    80%        { border-radius: 70% 30% 50% 60% / 40% 60% 30% 50%; }
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 0%;     }
    50%       { background-position: 100% 100%; }
}

@keyframes core-glow {
    from { box-shadow: 0 0 28px 6px rgba(240,78,42,0.55), 0 0 60px 22px rgba(240,78,42,0.15); }
    to   { box-shadow: 0 0 42px 12px rgba(240,78,42,0.9), 0 0 100px 40px rgba(240,78,42,0.28); }
}

/* Label */
.ai-loader__label {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    transition: opacity 0.3s ease;
    z-index: 1;
}

/* Progress bar */
.ai-loader__bar {
    width: 180px;
    height: 2px;
    background: var(--surface-hover);
    border-radius: 1px;
    overflow: hidden;
    z-index: 1;
}

.ai-loader__bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f04e2a, #f8944a);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(240, 78, 42, 0.7);
    animation: fake-progress 40s ease-out forwards;
}

@keyframes fake-progress {
    0%   { width:  0%; }
    10%  { width: 18%; }
    30%  { width: 42%; }
    60%  { width: 67%; }
    85%  { width: 83%; }
    100% { width: 88%; }
}

/* ── Select ───────────────────────────────────────────── */
.param-select {
    width: 100%;
    height: 40px;
    padding: 0 32px 0 12px;
    background: var(--surface-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    box-sizing: border-box;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8680' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.15s;
}

.param-select:focus {
    border-color: var(--accent);
}

.param-select option {
    background: var(--select-option-bg);
    color: var(--text);
}

/* Disabled toggle */
.btn-toggle:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Frame slots ──────────────────────────────────────── */
.frame-slots {
    display: grid;
    gap: 8px;
}

.frame-slots--2 { grid-template-columns: 1fr 1fr; }
.frame-slots--3 { grid-template-columns: 1fr 1fr 1fr; }
.frame-slots--2-sm {
    grid-template-columns: 1fr 1fr;
    max-width: calc((200% - 8px) / 3);
    margin-inline: auto;
}
.frame-slots--thumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.frame-slots--thumb .frame-slot {
    width: 64px;
    height: 64px;
    aspect-ratio: unset;
    border-radius: 8px;
    flex-shrink: 0;
}
.frame-slots--thumb.frame-slots--96 .frame-slot {
    width: 96px;
    height: 96px;
}
.frame-slots--thumb .frame-slot__placeholder span,
.frame-slots--thumb .frame-slot__placeholder small {
    display: none;
}
.frame-slots--thumb .frame-slot__placeholder {
    padding: 4px;
    gap: 0;
}
.frame-slots--thumb .frame-slot__remove {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    top: 2px;
    right: 2px;
}
.frame-slot-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.frame-slot-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.frame-slot {
    position: relative;
    aspect-ratio: 1;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.15s, background 0.15s;
}

.frame-slot:hover:not(.frame-slot--filled):not(.frame-slot--loading) {
    border-color: var(--border-hover);
    background: var(--surface-input);
}

.frame-slot__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--text-muted);
    pointer-events: none;
    padding: 8px;
    text-align: center;
}

.frame-slot__placeholder span {
    font-size: 0.75rem;
    font-weight: 500;
}

.frame-slot__placeholder small {
    font-size: 0.65rem;
    opacity: 0.55;
}

.frame-slot__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-slot__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}

.frame-slot--filled {
    border-color: rgba(240, 78, 42, 0.35);
    cursor: default;
}

.frame-slot--filled:hover .frame-slot__remove {
    opacity: 1;
}

.frame-slot--loading {
    pointer-events: none;
}

.frame-slot--loading::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--loading-overlay);
}

/* ── Toggle switch ────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--spinner-ring);
    border-radius: 24px;
    transition: background 0.2s;
    border: 1px solid var(--border);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ── Suno track cards ───────────────────────────────── */
.preview-tracks {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.suno-track {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.suno-track:hover {
    border-color: rgba(240, 78, 42, 0.35);
}

.suno-track__header {
    display: flex;
    gap: 14px;
    padding: 16px 16px 12px;
    align-items: flex-start;
}

.suno-track__cover {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-hover);
}

.suno-track__cover-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(240, 78, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    opacity: 0.6;
}

.suno-track__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
}

.suno-track__label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    opacity: 0.8;
}

.suno-track__title {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suno-track__tags {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.suno-track__duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.55;
    margin-top: 2px;
}

.suno-track__player {
    padding: 0 14px 14px;
}

.suno-track__player audio {
    width: 100%;
    border-radius: 8px;
    outline: none;
    display: block;
}

/* ── Char counter ────────────────────────────────────── */
.param-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
    opacity: 0.65;
}

/* ── Audio preview ───────────────────────────────────── */
.preview-audio {
    width: 100%;
    max-width: 520px;
    border-radius: 12px;
    display: block;
    margin: auto;
    outline: none;
}

/* ── Video preview ────────────────────────────────────── */
.preview-video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    outline: none;
}

.btn-toggle-group--wrap {
    flex-wrap: wrap;
}

/* ── Video slot ──────────────────────────────────────── */
.frame-slot__video-info {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.frame-slot__video-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    outline: none;
    display: block;
}

.frame-slot__filename {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.7;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

/* ── Audio slot ──────────────────────────────────────── */
.frame-slot__audio-info {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* native player hidden — playback driven by the custom play button */
.frame-slot__audio-player {
    display: none;
}

/* ── Custom play / pause button (video & audio slots) ── */
.frame-slot__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: background 0.15s, transform 0.15s;
}
.frame-slot__play:hover {
    background: var(--accent);
    transform: translate(-50%, -50%) scale(1.08);
}
.frame-slot__play-icon { display: block; }
.frame-slot__play-icon--play  { margin-left: 2px; }
.frame-slot__play-icon--pause { display: none; }
.frame-slot--playing .frame-slot__play-icon--play  { display: none; }
.frame-slot--playing .frame-slot__play-icon--pause { display: block; }

/* ── Range slider ────────────────────────────────────── */
.param-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.param-slider-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}

.param-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: transform 0.15s;
}

.param-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.param-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    transition: transform 0.15s;
}

.param-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* ── Dashboard layout ─────────────────────────────────── */

.dashboard-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.dash-sidebar {
    width: 220px;
    min-width: 220px;
    border-right: 1px solid var(--border);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.dash-nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 4px;
}

.dash-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    line-height: 1;
}

.dash-nav-item:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.dash-nav-item.active {
    color: var(--accent);
    background: rgba(240, 78, 42, 0.12);
}

.dash-nav-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.dash-nav-item:hover svg,
.dash-nav-item.active svg {
    opacity: 1;
}

.dashboard-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    position: relative;
    overflow: auto;
}

.dashboard-main::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(240, 78, 42, 0.10) 0%, transparent 70%);
    pointer-events: none;
}

.dashboard-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    position: relative;
    text-align: center;
    max-width: none;
    overflow: hidden;
}

.ai-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.welcome-content {
    position: relative;
    z-index: 1;
}

.dashboard-welcome h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

.dashboard-welcome p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ── My Generations panel ─────────────────────────────── */

.dash-gens {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 28px 32px;
    overflow: hidden;
}

.dash-gens__tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.dash-tab {
    padding: 7px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.dash-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.dash-tab.active {
    color: var(--accent);
    background: rgba(240, 78, 42, 0.12);
    border-color: rgba(240, 78, 42, 0.4);
}

.dash-gens__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    overflow-y: auto;
    align-content: start;
}

.dash-gens__empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding-top: 48px;
}

.gen-card {
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.gen-card:hover {
    border-color: rgba(240, 78, 42, 0.4);
    transform: translateY(-2px);
}

.gen-card__thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: var(--surface-input);
}

.gen-card__thumb--video {
    aspect-ratio: 9/16;
    object-fit: cover;
}

.gen-card__video {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
    display: block;
    background: #000;
}

.gen-card__placeholder {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}

.gen-card__placeholder--broken {
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.gen-card__img-wrap {
    position: relative;
    overflow: hidden;
}

.gen-card__overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 24px 10px 10px;
    display: flex;
    gap: 8px;
    justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
    transform: translateY(100%);
    transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
}

.gen-card:hover .gen-card__overlay {
    transform: translateY(0);
    pointer-events: auto;
}

.gen-card__action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.28);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    color: #fff;
}

.gen-card__action-btn:hover { transform: scale(1.12); }

.gen-card__action-btn--dl {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gen-card__action-btn--dl:hover {
    background: rgba(255,255,255,0.28);
    box-shadow: 0 2px 14px rgba(255,255,255,0.15);
}

.gen-card__action-btn--anim {
    background: linear-gradient(135deg, #f04e2a 0%, #9333ea 100%);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 2px 14px rgba(240,78,42,0.5);
    overflow: hidden;
    position: relative;
}

.gen-card__action-btn--anim::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.32) 50%, transparent 65%);
    transform: translateX(-100%);
    animation: card-btn-shine 2.4s infinite;
}

@keyframes card-btn-shine {
    0%   { transform: translateX(-100%); }
    60%  { transform: translateX(100%); }
    100% { transform: translateX(100%); }
}

/* Edit button — squircle, amber */
.gen-card__action-btn--edit {
    border-radius: 9px;
    background: rgba(245,158,11,0.14);
    border-color: rgba(245,158,11,0.3);
    color: #f59e0b;
}
.gen-card__action-btn--edit:hover {
    background: rgba(245,158,11,0.28);
    border-color: rgba(245,158,11,0.6);
    box-shadow: 0 2px 14px rgba(245,158,11,0.35);
}

/* Delete button — squircle, neutral → red on arm */
.gen-card__action-btn--del {
    border-radius: 9px;
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.4);
    transition: background 0.15s, border-color 0.15s, color 0.15s,
                box-shadow 0.15s, transform 0.15s;
}
.gen-card__action-btn--del:hover {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.45);
    color: #ef4444;
    box-shadow: 0 2px 12px rgba(239,68,68,0.28);
}
.gen-card__action-btn--del-armed {
    background: rgba(239,68,68,0.26) !important;
    border-color: rgba(239,68,68,0.7) !important;
    color: #ef4444 !important;
    box-shadow: 0 0 0 0 rgba(239,68,68,0.6);
    animation: del-arm-pulse 0.55s ease-in-out infinite alternate;
}
@keyframes del-arm-pulse {
    from { box-shadow: 0 0 4px 0   rgba(239,68,68,0.45); }
    to   { box-shadow: 0 0 12px 3px rgba(239,68,68,0.75); }
}

/* Card collapse on delete */
.gen-card--deleting {
    pointer-events: none;
    animation: card-collapse 0.34s cubic-bezier(0.4,0,0.8,1) forwards;
}
@keyframes card-collapse {
    0%  { opacity: 1; transform: scale(1); }
    25% { opacity: 1; transform: scale(1.04); }
    100%{ opacity: 0; transform: scale(0.78) translateY(8px); }
}

@media (hover: none) {
    .gen-card__overlay {
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* ── Video card (hover muted preview) ────────────────── */
.vid-card {
    position: relative;
    aspect-ratio: 9/16;
    background: linear-gradient(160deg, #1e1e2e 0%, #111118 100%);
    overflow: hidden;
    cursor: pointer;
}

.vid-card__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vid-card__hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.28);
    color: #fff;
    transition: opacity 0.2s;
    pointer-events: none;
}

.vid-card--playing .vid-card__hint {
    opacity: 0;
}

@media (hover: none) {
    .vid-card__hint svg {
        width: 36px;
        height: 36px;
    }
}

/* ── Video modal ────────────────────────────────────────── */
.vid-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}

.vid-modal--open {
    opacity: 1;
    pointer-events: auto;
}

.vid-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.vid-modal__box {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 96vw;
    max-height: 96vh;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}

.vid-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.52);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.vid-modal__close:hover {
    background: rgba(0,0,0,0.75);
    color: #fff;
}

.vid-modal__video {
    display: block;
    max-width: 96vw;
    max-height: calc(96vh - 64px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #000;
    margin: 0 auto;
}

.vid-modal__controls {
    background: #0d0d0d;
    flex-shrink: 0;
}

.vid-modal__bar {
    height: 4px;
    background: rgba(255,255,255,0.12);
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}

.vid-modal__bar:hover {
    height: 6px;
}

.vid-modal__bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(240,78,42,0.75);
    pointer-events: none;
    transition: width 0.1s linear;
}

.vid-modal__bottom {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
}

.vid-modal__btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.vid-modal__btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.vid-modal__btn--dl {
    background: rgba(240,78,42,0.15);
    color: var(--accent);
}

.vid-modal__btn--dl:hover {
    background: rgba(240,78,42,0.28);
}

.vid-modal__time {
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    padding: 0 6px;
}

.vid-modal__spacer { flex: 1; }

/* ── Image lightbox ─────────────────────────────────────── */
.img-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}
.img-modal--open {
    opacity: 1;
    pointer-events: auto;
}
.img-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.img-modal__box {
    position: relative;
    z-index: 1;
    width: min(90vw, 1280px);
    height: 90vh;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 32px 96px rgba(0,0,0,0.75);
}
.img-modal__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    will-change: transform, opacity;
}
.img-modal__close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.img-modal__close:hover { background: rgba(0,0,0,0.8); color: #fff; }
.img-modal__arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.img-modal__arrow:hover { background: rgba(0,0,0,0.78); color: #fff; }
.img-modal__arrow--prev { left: 14px; }
.img-modal__arrow--next { right: 14px; }
.img-modal__arrow--hidden { opacity: 0; pointer-events: none; }
.img-modal__counter {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.74rem;
    color: rgba(255,255,255,0.55);
    background: rgba(0,0,0,0.42);
    padding: 3px 12px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}
.img-modal__actions {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 6px;
    padding: 5px;
    background: rgba(10,10,10,0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    white-space: nowrap;
}
.img-modal__act-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 40px;
    border: none;
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.img-modal__act-btn--dl {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.82);
}
.img-modal__act-btn--dl:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.img-modal__act-btn--edit {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}
.img-modal__act-btn--edit:hover {
    background: rgba(245,158,11,0.28);
    box-shadow: 0 0 12px rgba(245,158,11,0.25);
}
.img-modal__act-btn--anim {
    background: linear-gradient(135deg, #f04e2a 0%, #9333ea 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(240,78,42,0.4);
}
.img-modal__act-btn--anim::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.22) 50%, transparent 65%);
    transform: translateX(-100%);
    animation: card-btn-shine 2.6s infinite;
}
.img-modal__act-btn--anim:hover {
    box-shadow: 0 2px 18px rgba(240,78,42,0.6);
}
.img-modal__act-btn--del {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.55);
}
.img-modal__act-btn--del:hover {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
    box-shadow: 0 2px 12px rgba(239,68,68,0.28);
}
.img-modal__act-btn--del-armed {
    background: rgba(239,68,68,0.28) !important;
    color: #ef4444 !important;
    animation: del-arm-pulse 0.55s ease-in-out infinite alternate;
}
@media (max-width: 480px) {
    .img-modal__act-btn span { display: none; }
    .img-modal__act-btn { padding: 8px 10px; }
}
@media (max-width: 600px) {
    .img-modal__arrow { width: 38px; height: 38px; }
    .img-modal__arrow--prev { left: 6px; }
    .img-modal__arrow--next { right: 6px; }
}

.gen-card__foot {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gen-card__foot-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.gen-card__model {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gen-card__prompt-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-input);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.gen-card__prompt-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.gen-card__prompt-btn:active { transform: scale(0.9); }

.gen-card__date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── Prompt modal ─────────────────────────────────────── */

.prompt-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.prompt-modal--open {
    opacity: 1;
    pointer-events: auto;
}

.prompt-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.prompt-modal__box {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transform: translateY(10px) scale(0.97);
    transition: transform 0.26s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.prompt-modal--open .prompt-modal__box {
    transform: translateY(0) scale(1);
}

.prompt-modal__head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.prompt-modal__title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.prompt-modal__close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.prompt-modal__close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.prompt-modal__body {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.prompt-modal__text {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.prompt-modal__foot {
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.prompt-modal__copy {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.prompt-modal__copy:hover { background: var(--accent-hover); }
.prompt-modal__copy:active { transform: scale(0.96); }

.prompt-modal__copy--done,
.prompt-modal__copy--done:hover {
    background: var(--bonus-color);
}

/* ── Music list ───────────────────────────────────────── */

.music-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.music-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.15s;
}

.music-row:hover {
    border-color: rgba(240, 78, 42, 0.35);
}

.music-row__info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.music-row__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-row__meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.music-player {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 2;
    min-width: 0;
}

.music-player__btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(240, 78, 42, 0.15);
    border: 1px solid rgba(240, 78, 42, 0.35);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}

.music-player__btn:hover {
    background: rgba(240, 78, 42, 0.28);
    transform: scale(1.07);
}

.music-player__btn--del {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.14);
    color: var(--text-muted);
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.music-player__btn--del:hover {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.45);
    color: #ef4444;
    transform: scale(1.07);
}
.music-player__btn--del-armed {
    background: rgba(239,68,68,0.26) !important;
    border-color: rgba(239,68,68,0.7) !important;
    color: #ef4444 !important;
}

.music-row--deleting {
    pointer-events: none;
    animation: row-collapse 0.34s cubic-bezier(0.4,0,0.8,1) forwards;
}
@keyframes row-collapse {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.96) translateX(10px); }
}

.music-player__progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.music-player__seek-wrap {
    flex: 1;
    position: relative;
    height: 4px;
}

.music-player__track {
    position: absolute;
    inset: 0;
    background: var(--spinner-ring);
    border-radius: 2px;
    overflow: hidden;
}

.music-player__fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.25s linear;
    pointer-events: none;
}

.music-player__seek {
    position: absolute;
    inset: -6px 0;
    width: 100%;
    height: calc(100% + 12px);
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.music-player--broken {
    gap: 8px;
    color: var(--text-muted);
    opacity: 0.45;
    font-size: 0.8rem;
    flex: 2;
}

.music-player__time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 36px;
    text-align: right;
}

/* ─────────────────────────────────────────────────────── */

.service-nav-mobile {
    display: none;
}

/* Active nav button */
.service-nav-btn.active {
    color: var(--text);
    background: var(--surface-hover);
}

/* Current dropdown item */
.dropdown-item.current {
    color: var(--accent);
}

/* ── Wallet ──────────────────────────────────────────── */
.dash-wallet {
    padding: 20px 28px;
}

/* Top row: stats left, balance right */
.wallet-top-row {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 16px;
    margin-bottom: 24px;
    align-items: stretch;
}

/* Stats card */
.wallet-stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 20px 12px;
    display: flex;
    flex-direction: column;
}

.wallet-stats-title {
    font-size: 0.67rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.3px;
    margin-bottom: 10px;
}

.wallet-stats-numbers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.wallet-stat {
    padding: 0 16px;
    border-left: 1px solid var(--border);
}
.wallet-stat:first-child {
    padding-left: 0;
    border-left: none;
}

.wallet-stat__val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 3px;
    margin-bottom: 3px;
}

.wallet-stat__u {
    font-size: 0.85rem;
    opacity: 0.5;
    font-weight: 400;
}

.wallet-stat__lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Bar chart */
.wallet-chart-wrap {
    margin-top: 10px;
}

.wallet-chart {
    width: 100%;
    height: auto;
    display: block;
}

.wc-day {
    font-size: 18px;
    fill: var(--chart-day-fill);
    font-family: inherit;
}

.wc-val {
    font-size: 15px;
    fill: var(--chart-val-fill);
    font-weight: 600;
    font-family: inherit;
}

/* Balance card */
.wallet-balance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
}

.wallet-balance-label {
    font-size: 0.67rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.3px;
}

.wallet-balance-amount {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--balance-color);
    line-height: 1;
}

.wallet-topup-btn {
    width: 100%;
    text-align: center;
}

/* Transaction history */
.wallet-history-title {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.3px;
    margin-bottom: 12px;
}

.wallet-tx {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.wallet-tx__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wallet-tx__desc {
    font-size: 0.92rem;
    font-weight: 500;
}

.wallet-tx__date {
    font-size: 0.77rem;
    color: var(--text-muted);
}

.wallet-tx__amount {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 16px;
}

.wallet-tx__amount--debit  { color: #f87171; }
.wallet-tx__amount--credit { color: #4ade80; }

.wallet-history-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 24px;
}

@media (max-width: 720px) {
    .dash-wallet { padding: 16px; }
    .wallet-top-row { grid-template-columns: 1fr; }
    .wallet-stats-numbers { grid-template-columns: repeat(2, 1fr); gap: 16px 0; }
    .wallet-stat { padding: 0 16px; }
    .wallet-stat:nth-child(odd) { padding-left: 0; border-left: none; }
    .wallet-stat:nth-child(even) { border-left: 1px solid var(--border); }
}

/* ── Mobile drawer toggle button (hidden on desktop) ───── */
.drawer-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.drawer-toggle-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* ── Drawer overlay backdrop ───────────────────────────── */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 499;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}

.drawer-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* ── Mobile navigation drawer ──────────────────────────── */
.mob-drawer {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    background: var(--bg);
    border-right: 1px solid var(--border);
    z-index: 500;
    transform: translateX(-100%);
    overflow-y: auto;
}

.mob-drawer.drawer-ready {
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.mob-drawer.drawer--open {
    transform: translateX(0);
}

.mob-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 14px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 1;
}

.mob-drawer__logo {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--logo-from) 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mob-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.mob-drawer__close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.mob-drawer__header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mob-drawer__chips {
    display: flex;
    gap: 6px;
}

.mob-drawer__footer {
    margin-top: auto;
    padding: 8px 4px 12px;
}

.mob-drawer__logout {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.mob-drawer__logout:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.mob-drawer__nav {
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mob-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    border: none;
    background: none;
    text-align: left;
    font-family: inherit;
    line-height: 1;
}

.mob-nav-item:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.mob-nav-item.active {
    color: var(--accent);
    background: rgba(240, 78, 42, 0.12);
}

.mob-nav-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.mob-nav-item:hover svg,
.mob-nav-item.active svg {
    opacity: 1;
}

.mob-nav-item--model {
    font-size: 0.84rem;
    padding: 7px 12px 7px 20px;
}

.mob-nav-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
    flex-shrink: 0;
}

.mob-drawer-category-label {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    color: var(--text-muted);
    padding: 10px 12px 2px;
    opacity: 0.5;
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Prevent iOS Safari auto-zoom on focus (requires font-size >= 16px) */
    input, textarea, select {
        font-size: 16px !important;
    }

    /* Hide the post-generation "Скачать" button on mobile */
    #preview-act-dl {
        display: none;
    }

    /* Hide gallery download button on mobile */
    .gen-card__action-btn--dl {
        display: none;
    }

    /* Header */
    .header {
        padding: 10px 12px;
        gap: 8px;
    }

    .logo {
        display: none;
    }

    .service-nav {
        overflow-x: auto;
        scrollbar-width: none;
        padding: 0 2px;
        gap: 0;
    }

    .service-nav::-webkit-scrollbar { display: none; }

    .service-nav .service-nav-btn {
        padding: 6px 9px;
        font-size: 0.82rem;
    }

    .user-name {
        display: none;
    }

    /* Hide Тарифы from header on mobile — it lives in the drawer */
    .plans-header-btn {
        display: none;
    }

    /* Hide theme toggle, balance chips and logout from header nav on mobile — they live in the drawer */
    .nav .btn-icon-toggle {
        display: none;
    }

    .nav .balance-chip {
        display: none;
    }

    .nav form {
        display: none !important;
    }

    .balance-chip {
        padding: 4px 9px 4px 6px;
        font-size: 0.82rem;
        gap: 4px;
    }

    .balance-chip svg {
        width: 15px;
        height: 15px;
    }

    .btn-outline {
        padding: 6px 12px;
        font-size: 0.82rem;
    }

    /* Show hamburger button; start non-interactive so iOS ghost clicks can't land on it */
    .drawer-toggle-btn {
        display: flex;
        pointer-events: none;
    }

    /* JS adds this class after the ghost-click window (~300ms) has passed */
    .drawer-toggle-btn.ham-ready {
        pointer-events: auto;
    }

    /* Show overlay when active */
    .drawer-overlay {
        display: block;
    }

    /* Show drawer */
    .mob-drawer {
        display: flex;
    }

    /* Generate page — allow body scroll */
    .generate-page {
        overflow: visible;
    }

    .generate-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 52px);
    }

    .generate-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 20px 16px;
        overflow: visible;
    }

    .generate-preview {
        min-height: 60vw;
        flex-shrink: 0;
    }

    /* Dashboard */
    .dash-sidebar {
        display: none;
    }

    .dash-gens__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .gen-card__foot {
        padding: 5px 7px;
    }

    .gen-card__model {
        font-size: 0.62rem;
    }

    .gen-card__date {
        font-size: 0.6rem;
    }

    /* Service nav below header on generate pages */
    .service-nav-mobile {
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding: 8px 16px;
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
    }
    .service-nav-mobile::-webkit-scrollbar { display: none; }

    /* Loader — scaled down proportionally (160/300 = 0.53) */
    .preview-loading {
        gap: 16px;
    }

    .ai-loader {
        width: 160px;
        height: 160px;
    }

    .ai-loader__ring--outer {
        width: 155px; height: 155px;
    }
    .ai-loader__ring--mid {
        width: 116px; height: 116px;
    }
    .ai-loader__ring--inner {
        width: 83px; height: 83px;
    }

    .ai-loader__pts--inner span:nth-child(1) { transform: rotate(0deg)   translateX(42px); }
    .ai-loader__pts--inner span:nth-child(2) { transform: rotate(45deg)  translateX(42px); }
    .ai-loader__pts--inner span:nth-child(3) { transform: rotate(90deg)  translateX(42px); }
    .ai-loader__pts--inner span:nth-child(4) { transform: rotate(135deg) translateX(42px); }
    .ai-loader__pts--inner span:nth-child(5) { transform: rotate(180deg) translateX(42px); }
    .ai-loader__pts--inner span:nth-child(6) { transform: rotate(225deg) translateX(42px); }
    .ai-loader__pts--inner span:nth-child(7) { transform: rotate(270deg) translateX(42px); }
    .ai-loader__pts--inner span:nth-child(8) { transform: rotate(315deg) translateX(42px); }

    .ai-loader__pts--outer span:nth-child(1) { transform: rotate(0deg)   translateX(77px); }
    .ai-loader__pts--outer span:nth-child(2) { transform: rotate(72deg)  translateX(77px); }
    .ai-loader__pts--outer span:nth-child(3) { transform: rotate(144deg) translateX(77px); }
    .ai-loader__pts--outer span:nth-child(4) { transform: rotate(216deg) translateX(77px); }
    .ai-loader__pts--outer span:nth-child(5) { transform: rotate(288deg) translateX(77px); }

    .ai-loader__core {
        width: 51px; height: 51px;
    }

    .ai-loader__bar {
        width: 120px;
    }

    .ai-loader__label {
        font-size: 12px;
    }
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    color: var(--toast-color);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9999;
    max-width: 90vw;
    white-space: normal;
    text-align: center;
}
.toast--error  { border-color: rgba(239,68,68,0.5); }
.toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.delete-hint {
    position: fixed;
    background: var(--toast-bg, var(--surface));
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.74rem;
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateY(4px);
    animation: delete-hint-in 0.15s ease forwards;
}
@keyframes delete-hint-in {
    to { opacity: 1; transform: translateY(0); }
}

/* ── TTS result ─────────────────────────────────────────────── */
.tts-result { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px 24px; width: 100%; }
.tts-result__player audio { width: 100%; min-width: 280px; max-width: 520px; border-radius: 8px; }
.tts-result__download { font-size: 0.85rem; padding: 8px 20px; text-decoration: none; }
.param-select:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Photo page (unified model selector) ────────────────────── */
.photo-param-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Size dropdown */
.size-dd { position: relative; }

.size-dd__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--surface-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    text-align: left;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.size-dd__trigger:hover { border-color: var(--border-hover); }
.size-dd--open .size-dd__trigger { border-color: var(--accent); border-radius: 10px 10px 0 0; }

.size-dd__chevron {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.size-dd--open .size-dd__chevron { transform: rotate(180deg); }

.size-dd__panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow-y: auto;
    max-height: 240px;
    z-index: 50;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}
.size-dd--open .size-dd__panel { display: block; }

.size-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 12px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.size-opt:last-child { border-bottom: none; }
.size-opt:hover { background: var(--surface-hover); color: var(--text); }
.size-opt.active { color: var(--accent); background: rgba(240,78,42,0.06); }

.size-opt__rect-wrap {
    width: 32px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.size-opt__rect {
    display: block;
    border: 1.5px solid currentColor;
    border-radius: 2px;
}

/* Upload zone — inline thumbs mode */
.upload-zone--photo {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: flex-start;
    padding: 10px;
    gap: 8px;
    height: 86px;
    overflow: hidden;
}
.upload-zone--photo:not(.upload-zone--has-images) {
    justify-content: center;
    align-items: center;
    align-content: center;
}
.upload-zone__prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.85rem;
}
.upload-zone--photo.upload-zone--has-images .upload-zone__prompt {
    width: 64px;
    height: 64px;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    justify-content: center;
    gap: 0;
}
.upload-zone--photo.upload-zone--has-images .upload-zone__prompt svg,
.upload-zone--photo.upload-zone--has-images .upload-zone__prompt span { display: none; }
.upload-zone--photo.upload-zone--has-images .upload-zone__prompt::after {
    content: '+';
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--text-muted);
}
.upload-zone--photo.upload-zone-full .upload-zone__prompt { display: none; }
