.bonus-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.tg-bonus-btn-wrapper {
    max-width: 100%;
}

.tg-bonus-btn {
    max-width: 100%;
    white-space: normal;
}

@media (max-width: 768px) {

    .tg-bonus-btn-wrapper,
    .tg-bonus-btn {
        width: 100%;
    }

    .tg-bonus-btn {
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 40px;
    }

    .tg-bonus-qr-popup {
        right: 50%;
        transform: translateX(50%);
        width: min(220px, calc(100vw - 32px));
    }

    .bonus-section {
        padding: 12px;
    }

    .bonus-section > div {
        flex-direction: column;
        align-items: stretch;
    }

    .bonus-section > div > div:first-child {
        min-width: 0;
    }

    .tg-bonus-btn-profile {
        width: 100%;
        max-width: 100%;
        white-space: normal;
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    #tgBonusQrProfile {
        right: 50% !important;
        transform: translateX(50%);
        width: min(220px, calc(100vw - 32px)) !important;
    }
}

/* .lyrics-hint migrated to create.css & uikit design tokens */

.dashboard-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.dashboard-title-wrap h2 {
  margin: 0 0 10px 0;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  color: var(--color-text-base);
  text-wrap: balance;
}

.dashboard-title-wrap p {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 700px;
}

/* History section extracted styles */

.history-header-title {
    margin: 0;
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
}

.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 36px 20px;
    text-align: center;
}

.history-empty-state__text {
    color: var(--color-text-subtle);
    font-size: 1rem;
    line-height: 1.6;
}

.history-empty-state__links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.history-empty-state-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: var(--ds-radius-pill);
    text-decoration: none;
    color: var(--color-link);
    background: color-mix(in oklch, var(--color-link) 8%, transparent);
    border: 1px solid color-mix(in oklch, var(--color-link) 18%, transparent);
    font-weight: 700;
    line-height: 1.3;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.history-empty-state-link:hover {
    color: var(--color-text-base);
    background: color-mix(in oklch, var(--color-link) 14%, transparent);
    border-color: color-mix(in oklch, var(--color-link) 28%, transparent);
    transform: translateY(-1px);
    text-decoration: none;
}

@media (max-width: 768px) {
    .history-empty-state {
        padding: 28px 16px;
        gap: 12px;
    }

    .history-empty-state__text {
        font-size: 0.95rem;
    }

    .history-empty-state__links {
        width: 100%;
    }

    .history-empty-state-link {
        width: 100%;
        max-width: 320px;
        min-height: 44px;
        padding: 10px 16px;
        text-align: center;
    }
}

.history-pre-wrap {
    position: relative;
}

.history-pre {
    background: var(--surface-glass-soft);
    padding: 10px;
    border: var(--border-subtle);
    border-radius: var(--ds-radius-sm);
    white-space: pre-wrap;
    color: var(--color-text-muted);
    font-family: monospace;
    font-size: 0.9em;
}

.history-pre-wrap--icon-top-right .history-pre {
    padding-top: 56px;
}

.history-pre--prompt {
    background: var(--border-subtle);
    padding: 8px;
    margin-top: 5px;
    font-size: 0.8em;
}

.history-video {
    width: 100%;
    margin: 10px 0;
    max-height: 300px;
}

/* Index / create extracted styles */

.field-error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 2px color-mix(in oklch, var(--color-danger) 20%, transparent);
}

.create-page-shell .tg-bonus-banner {
    animation: none;
}

.tg-bonus-btn-wrapper {
    position: relative;
    overflow: visible;
    z-index: 60;
}

.tg-bonus-btn {
    background: var(--gradient-telegram);
    color: var(--color-text-base);
    border: 1px solid color-mix(in oklch, var(--color-brand-telegram) 30%, transparent);
    padding: 10px 25px;
    font-weight: 700;
    border-radius: var(--ds-radius-md);
    font-size: 1rem;
    min-height: 44px;
    width: auto;
    box-shadow: var(--shadow-glow-primary);
}

.tg-bonus-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.tg-bonus-qr-popup {
    display: none;
    position: absolute;
    top: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-modal-bg);
    border: var(--border-subtle);
    border-radius: var(--ds-radius-md);
    padding: 15px;
    width: 180px;
    box-shadow: var(--shadow-float-lg);
    z-index: var(--z-dropdown);
}

.tg-bonus-qr-popup::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-bottom-color: var(--color-surface-1);
}

.bonus-option {
    position: relative;
    display: inline-block;
}

.bonus-option:hover .tg-bonus-qr-popup {
    display: block;
}

.tg-bonus-qr-popup img {
    width: 150px;
    height: 150px;
    background: var(--color-text-base);
    padding: 5px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.tg-bonus-qr-popup span {
    display: block;
    color: var(--color-text-base);
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
}

.tg-bonus-close {
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    width: 32px;
    height: 32px;
background:  var(--surface-glass-base);
    border: none;
    border-radius: var(--ds-radius-pill);
    color: var(--color-text-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: none;
    z-index: var(--z-dropdown);
    padding: 0;
    margin: 0;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.tg-bonus-close:hover {
    color: var(--color-text-base);
background:  var(--surface-glass-hover);
    transition: background 0.2s ease, color 0.2s ease;
}

.tg-bonus-close svg {
    display: block;
    pointer-events: none;
}

@media (max-width: 768px) {

    .tg-bonus-btn-wrapper,
    .tg-bonus-btn {
        width: 100%;
    }

    .tg-bonus-btn {
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 40px;
    }
}

.main-content-top {
    margin-top: 20px;
}

.hint-text {
    margin: 0;
    color: var(--color-text-base);
    font-size: 1em;
    line-height: 1.6;
    font-weight: 500;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.control-row--wrap {
    flex-wrap: wrap;
}

.control-row--lyrics-ai {
    margin: 0 0 10px;
    min-height: 38px;
}

.lyrics-clear-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface-glass-soft);
    color: var(--color-text-muted);
    cursor: pointer;
    margin-left: auto;
    box-shadow: inset 0 1px 0 var(--surface-glass-soft), var(--shadow-float-sm);
    transition: background var(--ds-transition-fast), color var(--ds-transition-fast), border-color var(--ds-transition-fast), transform var(--ds-transition-fast), opacity var(--ds-transition-fast);
}

.lyrics-clear-btn[hidden] {
    display: none;
}

.lyrics-clear-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lyrics-clear-btn:hover,
.lyrics-clear-btn:focus-visible {
    background: var(--color-danger-bg);
    border-color: color-mix(in oklch, var(--color-danger) 35%, transparent);
    color: var(--color-danger);
}

.lyrics-clear-btn:hover {
    transform: translateY(-1px);
}

.lyrics-clear-btn:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus-ring);
}

.history-pre-wrap--actions-end .history-pre,
.history-pre-wrap--icon-top-right .history-pre {
    width: 100%;
}

.tag-button-inline {
    cursor: pointer;
    user-select: none;
    width: auto;
    display: inline-block;
}

.lyrics-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-base);
    border-top: 2px solid var(--color-text-base);
    border-radius: var(--radius-pill);
    animation: spin 1s linear infinite;
}

.advanced-details {
    margin: 20px 0;
    border: 1px solid var(--ds-border-soft);
    border-radius: var(--ds-radius-sm);
background:  var(--surface-glass-soft);
}

.advanced-details summary {
    padding: 12px;
    cursor: pointer;
    color: var(--color-text-base);
    font-weight: 500;
    user-select: none;
}

.advanced-details__body {
    padding: 12px;
    border-top: 1px solid var(--ds-border-soft);
}

.advanced-field-label {
    margin-top: 15px;
    display: block;
}

.advanced-field-label--relative {
    position: relative;
}

.advanced-input-spacing {
    margin-bottom: 8px;
}

.payment-method-wrap {
    margin-bottom: 15px;
}

.payment-method-label {
    display: block;
    margin-bottom: 8px;
}

.payment-method-select {
    width: 100%;
    padding: 8px;
    background: var(--border-subtle);
    border: 1px solid var(--ds-border-soft);
    border-radius: var(--ds-radius-sm);
    color: var(--color-text-base);
}

@media (max-width: 768px) {
    .tg-bonus-qr-popup,
    #tgBonusQrProfile {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* history_section.html extracted styles */

    .history-tabs {
        background: var(--color-surface-0) !important;
        padding: 4px !important;
        border-radius: var(--radius-pill) !important;
        border: 1px solid var(--border-subtle) !important;
        gap: 4px !important;
        display: inline-flex !important;
        box-shadow: var(--shadow-inset-soft) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        margin-bottom: 16px !important;
    }

    .history-tabs::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }

    .history-tab {
        flex: 1 1 auto;
        min-width: 0;
        padding: 8px 14px !important;
        min-height: 36px !important;
        border-radius: var(--radius-pill);
        border: none;
        background: transparent;
        color: var(--color-text-muted);
        cursor: pointer;
        transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
        font-weight: 750;
        font-size: 0.88rem !important;
        letter-spacing: -0.01em;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-family: inherit;
        text-rendering: geometricPrecision;
        -webkit-font-smoothing: antialiased;
        white-space: nowrap;
    }

    .history-tab:not(.active):hover {
        background: var(--surface-glass-soft) !important;
        color: var(--color-text-base) !important;
    }

    .history-tab.active {
        background: var(--surface-glass-active) !important;
        color: var(--color-bg-base) !important;
        box-shadow: var(--shadow-float-md), var(--shadow-inset-strong) !important;
    }

    @media (max-width: 768px) {
        .history-tabs {
            padding: 3px !important;
            gap: 3px !important;
        }

        .history-tab {
            padding: 6px 6px !important;
            min-height: 34px !important;
            font-size: 0.8rem !important;
        }
    }

    @media (max-width: 640px) {
        .history-tabs {
            padding: 3px !important;
            gap: 2.5px !important;
        }

        .history-tab {
            padding: 6px 4px !important;
            min-height: 32px !important;
            font-size: 0.76rem !important;
        }
    }
    
    .history-tab:focus-visible {
        outline: none;
        box-shadow: var(--ds-focus-ring) !important;
    }

    .history-task-action-btn {
        list-style: none;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 30px;
        flex: 1 1 0;
        min-width: 80px;
        max-width: 100%;
        padding: 5px 10px;
        border-radius: var(--radius-md);
        border: var(--border-base);
background:  var(--surface-glass-soft);
color: var(--color-text-muted);
        cursor: pointer;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
        box-sizing: border-box;
        transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    }

    .history-task-action-btn::after {
        content: '▾';
        font-size: 12px;
        opacity: 0.72;
        flex: 0 0 auto;
        align-self: flex-start;
        margin-top: 1px;
        transition: transform 0.18s ease, opacity 0.18s ease;
    }

    .history-task-action-btn.is-active::after {
        transform: rotate(180deg);
        opacity: 1;
    }

    .history-task-action-btn:hover {
background:  var(--surface-glass-base);
border-color:  var(--color-border-strong);
        color: var(--color-text-base);
    }

    .history-task-action-btn.is-active {
background:  var(--surface-glass-base);
border-color:  var(--color-border-strong);
        color: var(--color-text-base);
    }

    .history-task-action-panel .history-pre {
        margin-top: 6px;
        width: 100%;
        box-sizing: border-box;
    }

    .history-filter-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 34px;
        height: 34px;
        padding: 7px 14px;
        border-radius: var(--radius-pill);
        border: var(--border-strong);
        background: linear-gradient(180deg, var(--surface-glass-soft) 0%, var(--surface-glass-soft) 100%);
        color: var(--color-text-muted);
        font-size: 13px;
        font-weight: 700;
        box-shadow: inset 0 1px 0 var(--surface-glass-soft), var(--shadow-float-sm);
        transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
    }

    .history-filter-toggle:hover {
background:  var(--surface-glass-base);
border-color:  var(--color-border-strong);
        color: var(--color-text-base);
    }

    .history-filter-toggle.is-active {
        background: color-mix(in oklch, var(--color-brand-yellow) 16%, transparent);
        border-color: color-mix(in oklch, var(--color-brand-yellow) 45%, transparent);
        color: var(--color-brand-yellow);
    }

    .history-page-size {
        display: inline-flex;
        align-items: center;
        flex: 0 0 auto;
        max-width: 100%;
        min-height: 34px;
        height: 34px;
        padding: 0;
        border: var(--border-base);
        box-sizing: content-box;
    }

    .history-page-size__option {
        display: grid;
        place-items: center;
        min-width: 30px;
        width: 30px;
        min-height: 30px;
        height: 30px;
        padding: 0;
        line-height: 1;
        box-sizing: border-box;
        flex: 0 0 30px;
        font-size: 13px;
        font-weight: 700;
        vertical-align: baseline;
    }

    .history-page-size__option.is-active {
        color: var(--color-bg-base);
        background: linear-gradient(180deg, var(--color-text-base) 0%, color-mix(in oklch, var(--color-text-base) 90%, black) 100%);
        box-shadow: inset 0 1px 0 var(--surface-glass-hover);
    }

    @media (max-width: 640px) {

        .history-filter-toggle {
            margin-left: 0;
            justify-self: start;
        }
    }

    .history-favorite-btn {
color: var(--color-text-muted);
    }

    .history-favorite-btn .history-icon-btn__svg {
        width: 18px;
        height: 18px;
    }

    .history-favorite-btn.is-active {
        color: var(--color-brand-yellow);
        background: color-mix(in oklch, var(--color-brand-yellow) 14%, transparent);
        border-color: color-mix(in oklch, var(--color-brand-yellow) 36%, transparent);
    }

    .history-favorite-btn.is-active .history-icon-btn__svg {
        fill: currentColor;
        stroke: currentColor;
    }

    .track-icon-btn.is-loading,
    .track-pill-button.is-loading,
    .track-menu__item.is-loading {
        opacity: 0.72;
        pointer-events: none;
        cursor: wait;
    }

    .track-icon-btn.is-loading {
        transform: scale(0.98);
    }

    .track-icon-btn.is-loading .track-icon-btn__img,
    .track-icon-btn.is-loading .history-icon-btn__svg {
        opacity: 0.4;
    }

    .track-icon-btn.is-loading::after,
    .track-pill-button.is-loading::after,
    .track-menu__item.is-loading::after {
        content: '';
        width: 14px;
        height: 14px;
        border-radius: var(--radius-pill);
border:  2px solid var(--color-border-strong);
        border-top-color: var(--color-text-base);
        animation: historyDownloadSpin 0.7s linear infinite;
        flex: 0 0 auto;
    }

    .track-icon-btn.is-loading::after {
        position: absolute;
    }

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

    @keyframes historySkeletonShimmer {
        100% {
            transform: translateX(100%);
        }
    }
