/* ── Dashboard layout ── */

.page--dashboard {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100vh;
    background: linear-gradient(160deg, #e8f4fc 0%, #d4eef5 100%);
    position: relative;
}

.page--dashboard::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 600px 400px at 15% 10%, rgba(46, 196, 196, 0.18) 0%, transparent 70%),
        radial-gradient(ellipse 500px 350px at 85% 80%, rgba(94, 184, 232, 0.14) 0%, transparent 70%);
    z-index: 0;
}

.page--dashboard > * {
    position: relative;
    z-index: 1;
}

/* ── Header ── */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 28px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(13, 74, 122, 0.08);
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(13, 74, 122, 0.04),
        0 4px 16px rgba(13, 74, 122, 0.07),
        0 12px 32px rgba(13, 74, 122, 0.05);
    backdrop-filter: blur(8px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand__logo {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(135deg, #0d4a7a 0%, #1a9e9e 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 74, 122, 0.25);
}

.brand__title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0d4a7a;
    line-height: 1.2;
    margin: 0;
}

.brand__tagline {
    font-size: 0.78rem;
    font-weight: 500;
    color: #5a6b7c;
    margin: 2px 0 0;
    letter-spacing: 0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.balance {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fff4e6;
    border: 1px solid rgba(232, 93, 106, 0.18);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a2b3c;
}

.balance__icon {
    color: #e85d6a;
    flex-shrink: 0;
}

.btn-buy {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 999px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.875rem;
    color: #fff;
    background: linear-gradient(135deg, #1a9e9e 0%, #1565a8 100%);
    box-shadow: 0 3px 10px rgba(26, 158, 158, 0.3);
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-buy:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(26, 158, 158, 0.38);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.875rem;
    color: #5a6b7c;
    border: 1px solid rgba(13, 74, 122, 0.1);
    background: #f8fcff;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn-logout:hover {
    color: #0d4a7a;
    border-color: rgba(13, 74, 122, 0.2);
    background: #fff;
}

.heart {
    color: #e85d6a;
}

/* ── Profile card ── */

.profile-card {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(13, 74, 122, 0.07);
    border-radius: 14px;
}

.profile-card__top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-card__avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 2px;
    overflow: hidden;
    background: #e7e8ec;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-card__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #e7e8ec;
}

.profile-card__info {
    flex: 1;
    min-width: 0;
}

.profile-card__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2b587a;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.profile-card__icon {
    flex-shrink: 0;
    color: #6b9fc4;
}

.profile-card__fine {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 14px 0 0;
    padding-left: 66px;
    font-size: 0.875rem;
    color: #6b7c8d;
}

.profile-card__fine-label {
    color: #6b7c8d;
}

.profile-card__fine-value {
    font-weight: 500;
    color: #5a6b7c;
}

.profile-card__links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 12px;
    padding-left: 66px;
}

.profile-card__link {
    padding: 0;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 400;
    color: #5a8ab0;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1.5;
}

.profile-card__link:hover {
    color: #2b587a;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.profile-card__badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(90, 138, 176, 0.12);
    font-size: 0.75rem;
    font-weight: 500;
    color: #2b587a;
    text-decoration: none;
}

/* ── Tabs ── */

.main-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 999px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.875rem;
    color: #5a6b7c;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(13, 74, 122, 0.1);
    box-shadow: 0 1px 4px rgba(13, 74, 122, 0.05);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tab:hover:not(.tab--active) {
    color: #1565a8;
    border-color: rgba(13, 74, 122, 0.18);
}

.tab--active {
    color: #fff;
    background: linear-gradient(135deg, #0d4a7a 0%, #1e7ec8 100%);
    border-color: transparent;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(13, 74, 122, 0.28);
}

/* ── Create task card ── */

.create-task {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(13, 74, 122, 0.08);
    border-radius: 20px;
    box-shadow:
        0 1px 3px rgba(13, 74, 122, 0.05),
        0 8px 24px rgba(13, 74, 122, 0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.create-task__head {
    padding: 20px 28px 18px;
    background: linear-gradient(
        90deg,
        rgba(26, 158, 158, 0.07) 0%,
        rgba(94, 184, 232, 0.05) 60%,
        transparent 100%
    );
    border-bottom: 1px solid rgba(13, 74, 122, 0.06);
}

.create-task__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0d4a7a;
    letter-spacing: -0.01em;
    margin: 0;
}

.create-task__plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2ec4c4 0%, #5eb8e8 100%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.create-task__form {
    padding: 22px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.create-task__row {
    display: grid;
    grid-template-columns: 1fr 96px 1.4fr;
    gap: 12px;
}

.field-input--qty .field-input__control {
    text-align: center;
    padding-left: 12px;
    padding-right: 12px;
}

.field-input--qty .field-input__control::-webkit-outer-spin-button,
.field-input--qty .field-input__control::-webkit-inner-spin-button {
    opacity: 1;
}

.create-task__cost {
    margin: -4px 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #5a6b7c;
}

.create-task__cost:empty {
    display: none;
}

.field-select {
    position: relative;
    display: flex;
    align-items: center;
}

.field-select__icon {
    position: absolute;
    left: 14px;
    color: #1a9e9e;
    pointer-events: none;
    z-index: 1;
    display: flex;
}

.field-select__control {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 13px 36px 13px 42px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a2b3c;
    background: #f8fcff;
    border: 1.5px solid rgba(13, 74, 122, 0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-select__control:hover {
    border-color: rgba(26, 158, 158, 0.4);
}

.field-select__control:focus {
    outline: none;
    border-color: #1a9e9e;
    box-shadow: 0 0 0 3px rgba(26, 158, 158, 0.15);
}

.field-select__chevron {
    position: absolute;
    right: 14px;
    color: #5a6b7c;
    pointer-events: none;
}

.field-input__control {
    width: 100%;
    padding: 13px 16px;
    font-family: var(--font);
    font-size: 0.9rem;
    color: #1a2b3c;
    background: #f8fcff;
    border: 1.5px solid rgba(13, 74, 122, 0.12);
    border-radius: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input__control::placeholder {
    color: #9aabb8;
}

.field-input__control:hover {
    border-color: rgba(26, 158, 158, 0.4);
}

.field-input__control:focus {
    outline: none;
    border-color: #1a9e9e;
    box-shadow: 0 0 0 3px rgba(26, 158, 158, 0.15);
}

.comment-fields.hidden {
    display: none;
}

.comment-tone {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.comment-tone__option {
    flex: 1;
    cursor: pointer;
}

.comment-tone__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.comment-tone__label {
    display: block;
    padding: 10px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    color: #5a6b7c;
    background: #f8fcff;
    border: 1.5px solid rgba(13, 74, 122, 0.12);
    border-radius: 10px;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.comment-tone__option input:checked + .comment-tone__label {
    color: #0d4a7a;
    background: rgba(26, 158, 158, 0.1);
    border-color: #1a9e9e;
}

.comment-copy {
    position: relative;
}

.comment-copy__input {
    resize: vertical;
    min-height: 72px;
    padding-right: 120px;
}

.comment-copy__btn {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    color: #0d4a7a;
    background: #fff;
    border: 1.5px solid rgba(26, 158, 158, 0.35);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.comment-copy__btn:hover {
    background: rgba(26, 158, 158, 0.08);
    border-color: #1a9e9e;
}

.exchange-block__tone-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 12px;
}

.exchange-block__tone-tab {
    flex: 1;
    padding: 8px 6px;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    color: #5a6b7c;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.exchange-block__tone-tab--active {
    color: #0d4a7a;
    background: rgba(26, 158, 158, 0.1);
    border-color: #1a9e9e;
}

.exchange-block__copy-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 6px;
    padding: 8px 10px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.exchange-block__copy-text {
    flex: 1;
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
    word-break: break-word;
}

.exchange-block__copy-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    color: #0d4a7a;
    background: #fff;
    border: 1px solid rgba(26, 158, 158, 0.35);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.exchange-block__copy-btn:hover {
    background: rgba(26, 158, 158, 0.08);
}

.exchange-block__tone-badge {
    display: inline-block;
    margin: 0 0 4px;
    padding: 2px 7px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 4px;
}

.exchange-block__tone-badge--positive {
    color: #1a7a4a;
    background: rgba(26, 158, 90, 0.12);
}

.exchange-block__tone-badge--negative {
    color: #a83232;
    background: rgba(168, 50, 50, 0.1);
}

.btn-publish {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 14px 24px;
    border-radius: 12px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #1a9e9e 0%, #1565a8 55%, #0d4a7a 100%);
    box-shadow:
        0 2px 8px rgba(26, 158, 158, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-publish:hover {
    transform: translateY(-1px);
    box-shadow:
        0 6px 20px rgba(26, 158, 158, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dash-main {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ── My tasks ── */

.my-tasks {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(13, 74, 122, 0.08);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(13, 74, 122, 0.08);
}

.my-task-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(13, 74, 122, 0.08);
    font-size: 0.9rem;
}

.my-task-item__body {
    flex: 1;
    min-width: 0;
}

.my-task-item:last-child {
    border-bottom: none;
}

.my-task-item__url {
    display: inline-block;
    color: #1565a8;
    word-break: break-all;
    margin: 4px 0 0;
    font-size: 0.8rem;
    text-decoration: none;
}

.my-task-item__url:hover {
    text-decoration: underline;
}

.my-task-item__progress {
    height: 6px;
    background: rgba(13, 74, 122, 0.08);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 10px;
}

.my-task-item__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1565a8, #42a5f5);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.my-task-item__progress-text {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: #5a6b7c;
}

.my-task-item__meta {
    color: #5a6b7c;
    font-size: 0.82rem;
}

.my-task-item__delete {
    flex-shrink: 0;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: #fee2e2;
    color: #dc2626;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.my-task-item__delete:hover {
    background: #fecaca;
}

.my-tasks__empty {
    text-align: center;
    color: #5a6b7c;
    padding: 32px 16px;
    font-size: 0.95rem;
}

/* ── King of the Hill ── */

.king-section {
    margin-bottom: 20px;
}

.king-card {
    display: block;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 28px 24px 24px;
    background: linear-gradient(180deg, #fff9e6 0%, #fff 40%);
    border: 2px solid #f5d76e;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    font-family: var(--font);
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-md);
}

.king-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.king-card__crown {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 4px;
}

.king-card__title {
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #b45309;
    letter-spacing: -0.02em;
}

.king-card__avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vk-blue), var(--accent));
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #f5d76e;
    overflow: hidden;
}

.king-card__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.king-card__name {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.king-card__wins {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.king-card__cta {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vk-blue);
}

/* ── Exchange blocks grid ── */

.exchange-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.exchange-block {
    background: var(--surface);
    border: 1px solid #c5d4e8;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

.exchange-block__title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.exchange-block__list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exchange-block__item {
    font-size: 0.8rem;
    line-height: 1.45;
}

.exchange-block__extra {
    margin: 0 0 4px;
    padding: 6px 8px;
    background: var(--bg);
    border-radius: 6px;
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.exchange-block__task {
    margin: 0 0 2px;
    font-weight: 600;
    color: var(--text);
}

.exchange-block__url {
    display: inline-block;
    margin: 0 0 6px;
    color: var(--vk-blue);
    word-break: break-all;
    font-size: 0.75rem;
    text-decoration: none;
}

.exchange-block__url:hover {
    text-decoration: underline;
}

.exchange-block__item--placeholder {
    opacity: 0.85;
}

.exchange-block__link-hint {
    display: inline-block;
    margin: 0 0 6px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
}

.exchange-block__link-hint:hover {
    color: var(--text);
    text-decoration: underline;
}

.exchange-block__item--active {
    background: rgba(74, 158, 255, 0.08);
    border-radius: 8px;
    margin: 0 -6px;
    padding: 6px;
}

.exchange-block__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.exchange-block__reward {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.exchange-block__qty {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}

.exchange-block__do {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    background: var(--vk-blue);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background var(--transition);
}

.exchange-block__do:hover {
    background: var(--vk-blue-dark);
}

.exchange-block__do--verify {
    background: #16a34a;
}

.exchange-block__do--verify:hover {
    background: #15803d;
}

.exchange-block__do:disabled {
    opacity: 0.65;
    cursor: wait;
}

.exchange-block__empty {
    margin: auto 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    padding: 16px 0;
}

.exchange-block--locked {
    padding: 0;
    overflow: hidden;
    min-height: 160px;
}

.exchange-block__title--locked {
    margin: 0;
    padding: 12px 16px;
    background: #e8eef5;
    border-bottom: 1px solid #c5d4e8;
    color: #2a5885;
    font-size: 0.9rem;
}

.exchange-block__locked-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    background: #f5f7fa;
    min-height: 100px;
}

.exchange-block__start {
    border: none;
    background: none;
    padding: 0;
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--vk-blue);
    cursor: pointer;
    text-align: center;
    line-height: 1.45;
    transition: color var(--transition);
}

.exchange-block__start:hover {
    color: var(--vk-blue-dark);
    text-decoration: underline;
}

.exchange-block__btn {
    margin-top: 14px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(180deg, #4a9eff 0%, var(--vk-blue) 100%);
    color: #fff;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter var(--transition), transform var(--transition);
}

.exchange-block__btn:hover {
    filter: brightness(1.05);
}

.exchange-block__btn:active {
    transform: scale(0.98);
}

.footer--dash {
    padding: 16px;
    border-top: none;
    background: transparent;
}

.footer--dash .footer__link {
    font-size: 0.8rem;
}

/* ── Modals ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 24px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal__title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 800;
}

.modal__desc {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.modal__stat {
    margin: 0 0 20px;
    font-size: 1rem;
}

.modal__label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.modal__input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    margin-bottom: 16px;
    outline: none;
    transition: border-color var(--transition);
}

.modal__input:focus {
    border-color: var(--vk-blue);
}

.modal__textarea {
    resize: vertical;
    min-height: 80px;
}

.modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal__actions--col {
    flex-direction: column;
}

/* ── Alert modal (likes.fm style) ── */

.modal--alert {
    padding: 0;
    overflow: hidden;
    max-width: 400px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: min(90vh, 90dvh);
}

.modal--alert .modal__header,
.modal--alert .modal__footer,
.modal--alert .modal__footer--rules {
    flex-shrink: 0;
}

.modal--alert .modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #0d4a7a 0%, #1a9e9e 100%);
    color: #fff;
}

.modal__header-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.modal__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.modal__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.modal__body {
    padding: 20px 18px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--surface);
}

.modal__body p {
    margin: 0 0 12px;
}

.modal__body p:last-child {
    margin-bottom: 0;
}

.modal__header--welcome {
    background: #5181b8;
}

.modal__body--welcome {
    text-align: center;
    padding: 22px 20px;
}

.modal__body--welcome p {
    margin: 0 0 14px;
}

.modal__body--welcome p:last-child {
    margin-bottom: 0;
}

.welcome-heart {
    font-size: 0.95em;
}

.welcome-balance {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 0 18px;
    padding: 18px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff4e6 0%, #ffe8ec 100%);
    border: 1px solid rgba(232, 93, 106, 0.2);
}

.welcome-balance__icon {
    font-size: 1.6rem;
    line-height: 1;
    color: #e85d6a;
}

.welcome-balance__amount {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: #1a2b3c;
}

.welcome-balance__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.welcome-bonus {
    padding: 12px 14px;
    border-radius: 10px;
    background: #eef6ff;
    border: 1px solid rgba(81, 129, 184, 0.2);
    font-size: 0.88rem;
    line-height: 1.55;
}

.modal__body--rules {
    padding: 18px 16px 16px;
}

.modal__rules-warning {
    padding: 10px 12px;
    background: #fff4e6;
    border-radius: 8px;
    border-left: 3px solid #e85d6a;
}

.modal__rules-warning strong {
    color: #1a2b3c;
}

.modal__rules-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal__footer--rules {
    padding: 0 16px 16px;
    background: var(--surface);
    border-top: none;
}

.btn--full {
    width: 100%;
    justify-content: center;
}

.welcome-bonus__badge {
    display: inline-block;
    margin-bottom: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #5181b8;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.modal__link {
    color: var(--vk-blue);
    font-weight: 600;
    text-decoration: none;
}

.modal__link:hover {
    text-decoration: underline;
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
    background: #f1f5f9;
    border-top: 1px solid var(--border);
}

.modal__footer .btn {
    min-width: 96px;
    padding: 10px 20px;
}

.modal__footer--split {
    justify-content: space-between;
}

/* ── Order modal (likes) ── */

.modal--order {
    max-width: 520px;
}

.modal__body--order {
    padding: 16px 18px 18px;
}

.order-tabs {
    display: flex;
    background: #e4e9ef;
    border-bottom: 1px solid var(--border);
}

.order-tab {
    flex: 1;
    padding: 10px 6px;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    color: #5a6b7c;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.order-tab:hover {
    color: #0d4a7a;
}

.order-tab--active {
    background: #5181b8;
    color: #fff;
}

.order-instructions {
    margin: 0 0 12px;
    padding: 12px 14px;
    background: #f1f5f9;
    border: 1px solid #dde3ea;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.order-instructions__list {
    margin: 0;
    padding-left: 18px;
}

.order-instructions__list li {
    margin-bottom: 6px;
}

.order-instructions__list li:last-child {
    margin-bottom: 0;
}

.order-instructions code {
    font-size: 0.78rem;
    color: #0d4a7a;
    word-break: break-all;
}

.order-url-input {
    margin-bottom: 12px;
}

.order-field-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.order-field-row--age {
    align-items: flex-start;
}

.order-field-label {
    flex: 0 0 72px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.order-select {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    cursor: pointer;
}

.order-targeting-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px;
    padding: 0;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--vk-blue);
    cursor: pointer;
}

.order-targeting-toggle:hover {
    text-decoration: underline;
}

.order-targeting-toggle__arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.order-targeting {
    margin: 0 0 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.order-targeting.hidden {
    display: none;
}

.order-targeting__hint {
    margin: 0 0 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.order-age-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.order-age-input {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.order-age-sep {
    color: var(--text-muted);
}

.order-qty-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 6px;
    flex-wrap: wrap;
}

.order-qty-input {
    width: 88px;
    text-align: center;
}

.order-qty-suffix {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.order-qty-suffix .heart {
    color: #e64646;
}

.order-price {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.order-price strong {
    color: var(--text);
}

.modal__footer--order {
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.order-balance {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.order-balance strong {
    color: var(--text);
}

.order-footer-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ── Active orders modal ── */

.modal--orders {
    padding: 0;
    overflow: hidden;
    max-width: 480px;
    border-radius: 14px;
}

.modal__body--orders {
    padding: 0;
    max-height: min(420px, 55vh);
    overflow-y: auto;
}

.active-orders__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.active-order {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(13, 74, 122, 0.08);
}

.active-order:last-child {
    border-bottom: none;
}

.active-order__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(13, 74, 122, 0.08), rgba(26, 158, 158, 0.12));
    color: #1565a8;
}

.active-order__body {
    flex: 1;
    min-width: 0;
}

.active-order__url {
    display: block;
    color: #1565a8;
    font-size: 0.82rem;
    font-weight: 600;
    word-break: break-all;
    text-decoration: none;
    line-height: 1.35;
}

.active-order__url:hover {
    text-decoration: underline;
}

.active-order__progress-text {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--text);
}

.active-order__progress-text strong {
    color: #0d4a7a;
}

.active-order__progress {
    height: 5px;
    background: rgba(13, 74, 122, 0.08);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 8px;
}

.active-order__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0d4a7a, #1a9e9e);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.active-order__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.active-order__link {
    padding: 0;
    border: none;
    background: none;
    color: var(--vk-blue);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.active-order__link:hover {
    text-decoration: underline;
}

.active-order__link--cancel {
    color: #dc2626;
}

.active-order__sep {
    color: #cbd5e1;
    font-size: 0.78rem;
    user-select: none;
}

.active-orders__empty {
    margin: 0;
    padding: 24px 16px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.active-orders__create {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.active-orders__create-btn {
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #1565a8 0%, #1a9e9e 100%);
    color: #fff;
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
    box-shadow: 0 2px 8px rgba(13, 74, 122, 0.2);
}

.active-orders__create-btn:hover {
    filter: brightness(1.05);
}

.active-orders__create-btn:active {
    transform: scale(0.99);
}

.active-orders__create-btn--secondary {
    background: #fff;
    color: #1565a8;
    border: 1.5px solid rgba(21, 101, 168, 0.35);
    box-shadow: none;
}

.active-orders__create-btn--secondary:hover {
    background: rgba(21, 101, 168, 0.06);
    filter: none;
}

@media (max-width: 480px) {
    .modal-overlay {
        align-items: flex-end;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .modal--alert {
        max-width: 100%;
        max-height: min(88dvh, calc(100dvh - 24px));
        border-radius: 12px 12px 10px 10px;
    }

    .modal__header {
        padding: 12px 14px;
    }

    .modal__header-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }

    .modal__body--welcome {
        padding: 16px 14px;
        text-align: left;
    }

    .modal__body--welcome p {
        margin-bottom: 10px;
        font-size: 0.86rem;
        line-height: 1.5;
    }

    .welcome-balance {
        margin-bottom: 12px;
        padding: 14px 12px;
    }

    .welcome-balance__amount {
        font-size: 1.75rem;
    }

    .welcome-bonus {
        padding: 10px 12px;
        font-size: 0.84rem;
    }

    .modal__footer,
    .modal__footer--rules {
        padding: 12px 14px;
        justify-content: stretch;
    }

    .modal__footer .btn,
    .modal__footer--rules .btn {
        width: 100%;
        min-width: 0;
        padding: 12px 16px;
    }

    .modal--orders {
        max-width: 100%;
        border-radius: 12px;
    }

    .modal__body--orders {
        max-height: min(380px, 50vh);
    }
}

.btn {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition), opacity var(--transition);
}

.btn--primary {
    background: var(--vk-blue);
    color: #fff;
}

.btn--primary:hover:not(:disabled) {
    background: var(--vk-blue-dark);
}

.btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--accent {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.btn--accent:hover:not(:disabled) {
    filter: brightness(1.05);
}

.btn--ghost {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn--outline {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    background: transparent;
    color: var(--vk-blue);
    border: 2px solid var(--vk-blue);
    margin-bottom: 16px;
    width: 100%;
}

/* ── King modal ── */

.king-rules {
    margin: 0 0 16px;
    padding: 12px 14px 12px 28px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.king-rules li + li {
    margin-top: 6px;
}

.king-rival {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.king-rival__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vk-blue), var(--accent));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid #f5d76e;
    overflow: hidden;
}

.king-rival__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.king-rival__name {
    margin: 0 0 2px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.king-rival__wins {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.king-progress {
    height: 10px;
    background: var(--bg);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 8px;
}

.king-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--vk-blue), #f59e0b);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.king-progress__text {
    margin: 0 0 16px;
    font-size: 0.9rem;
    text-align: center;
}

.king-dice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: 600;
}

.king-dice__die {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg);
    border: 2px solid var(--border);
    font-size: 1.25rem;
}

.king-dice__plus,
.king-dice__eq {
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Toast ── */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 12px 20px;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    max-width: calc(100% - 32px);
    text-align: center;
}

.toast--show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast--success {
    background: #16a34a;
}

.toast--error {
    background: #dc2626;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .page--dashboard {
        padding: 16px 14px 36px;
        gap: 14px;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px 20px;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn-buy,
    .btn-logout {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }

    .create-task__head {
        padding: 16px 20px 14px;
    }

    .create-task__form {
        padding: 18px 20px 22px;
    }

    .create-task__row {
        grid-template-columns: 1fr;
    }

    .main-tabs {
        flex-wrap: wrap;
    }

    .profile-card {
        padding: 16px 18px;
    }

    .profile-card__fine,
    .profile-card__links {
        padding-left: 0;
    }

    .exchange-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .brand__tagline {
        font-size: 0.72rem;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .balance {
        justify-content: center;
    }
}

@media (min-width: 900px) {
    .exchange-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
