/* Top Heroes Tool page styles
   Reuses the shared design tokens from style.css and is compatible with
   the current tool page classes/ids without changing existing JS. */

:root {
    --tool-success: #22c55e;
    --tool-fail: #ef4444;
    --tool-warning: #f59e0b;
    --tool-surface: linear-gradient(180deg, var(--bg-soft), var(--card));
    --tool-surface-strong: var(--card-strong);
    --tool-border: var(--card-border);
}


body {
    margin: 0;
    font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(124, 156, 255, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(95, 132, 255, 0.10), transparent 25%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tool-main {
    flex: 1;
    padding: 28px 0 24px;
}

.tool-main .container {
    width: min(100% - 32px, 880px);
    margin: 0 auto;
}

.card {
    position: relative;
    overflow: hidden;
    background: var(--tool-surface);
    border: 1px solid var(--tool-border);
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
    isolation: isolate;
    animation: fadeUp 0.7s ease both;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(124, 156, 255, 0.18),
        transparent 38%,
        rgba(124, 156, 255, 0.08)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.card > * {
    position: relative;
    z-index: 1;
}

label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

input,
textarea {
    width: 100%;
    margin: 8px 0 15px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--tool-border);
    background: var(--tool-surface-strong);
    color: var(--text);
    outline: none;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
    box-sizing: border-box;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
textarea:focus {
    border-color: rgba(124, 156, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(124, 156, 255, 0.12);
}

.action-group {
    padding-top: 8px;
    display: flex;
    width: 100%;
    gap: 12px;
    flex-wrap: wrap;
}

.action-group .btn,
button {
    appearance: none;
    min-width: 0;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.96rem;
    color: #fff;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.action-group .btn {
    flex: 1 1 0;
}

button:hover,
.action-group .btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.03);
}

button:disabled,
.action-group .btn:disabled {
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn-checkin {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.22);
}

.btn-giftcode {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    box-shadow: 0 12px 28px rgba(79, 111, 255, 0.25);
}

.btn-history,
button.secondary {
    background: var(--secondary);
    color: var(--text);
    border-color: var(--tool-border);
    box-shadow: var(--shadow-soft);
}

h3 {
    margin: 0 0 14px;
    font-size: 1.12rem;
    letter-spacing: -0.01em;
}

.progress {
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    overflow: hidden;
    margin: 14px 0 18px;
    border: 1px solid var(--tool-border);
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #22c55e);
    transition: width 0.35s ease;
}

.table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    overflow: hidden;
}

.table thead th {
    padding: 14px 12px;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--tool-border);
    background: rgba(255,255,255,0.03);
}

.table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--tool-border);
    vertical-align: top;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.success { color: var(--tool-success); }
.fail { color: var(--tool-fail); }
.retry { color: var(--tool-warning); }

.giftcode-item,
.code-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 4px 6px 4px 0;
    border-radius: 12px;
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--tool-border);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.giftcode-item:hover,
.code-tag:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 156, 255, 0.35);
}

.step {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 8px;
    padding: 10px 12px;
    line-height: 1.45;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(148, 163, 184, 0.08);
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.step-badge-idle {
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.18);
}

.step-badge-success {
    color: #166534;
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.26);
}

.step-badge-fail {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.26);
}

.step-badge-running {
    color: #b45309;
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.26);
    animation: pulse 1s infinite;
}

.overlay,
.modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 22, 0.56);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    z-index: 90;
}

.loader {
    border: 6px solid rgba(255,255,255,0.16);
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    width: 54px;
    height: 54px;
    animation: spin 1s linear infinite;
}

.toast {
    position: fixed;
    top: 84px;
    right: 20px;
    z-index: 120;
    display: none;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--tool-border);
    background: var(--tool-surface-strong);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-row input {
    flex: 1;
}

.modal-content {
    background: var(--tool-surface);
    border: 1px solid var(--tool-border);
    padding: 20px;
    border-radius: 22px;
    width: min(700px, calc(100% - 24px));
    max-height: min(800px, calc(100vh - 40px));
    overflow: auto;
    position: relative;
    box-shadow: var(--shadow);
}

.hidden {
    display: none !important;
}

.tool-site-footer {
    padding-top: 4px;
}

.footer-simple-tool {
    min-height: 48px;
}

.footer-tool-name {
    color: var(--text);
    font-weight: 700;
}

.footer-divider-inline {
    display: inline-block;
    margin: 0 8px;
    opacity: 0.55;
}

.version {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--tool-border);
    background: var(--secondary);
    color: var(--text-muted);
    font-size: 0.82rem;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse {
    0% { opacity: 0.3; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.9); }
}



/* Simple header brand treatment */
.brand {
    gap: 12px;
}

.brand-logo-stack {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

/* ===== TITLE WITH ICON ===== */

.tool-title {

    text-align: center;

    margin-bottom: 22px;

}


/* Main */

.tool-title-main {

    margin: 0;

    display: flex;

    flex-direction: column;

    gap: 6px;

}


/* Top line wrapper */

.tool-title-sub-wrap {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

}


/* Icon */

.tool-title-icon {

    width: 22px;

    height: 22px;

    object-fit: contain;

    flex-shrink: 0;

}


/* Top text */

.tool-title-sub {

    font-size: 0.9rem;

    font-weight: 600;

    letter-spacing: 0.08em;

    text-transform: uppercase;

    color: var(--primary);

}


/* Bottom text */

.tool-title-desc {

    font-size: 1.25rem;

    font-weight: 700;

    color: var(--text);

}


/* Decorative line */

.tool-title::after {

    content: "";

    display: block;

    width: 60px;

    height: 2px;

    margin: 10px auto 0;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--primary-strong)
        );

    border-radius: 999px;

    opacity: 0.6;

}

/* Stronger light-mode borders for readability */
body.light-mode textarea,
body.light-mode input {
    border-color: rgba(20, 30, 60, 0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

body.light-mode textarea:hover,
body.light-mode input:hover {
    border-color: rgba(20, 30, 60, 0.36);
}

body.light-mode .giftcode-item,
body.light-mode .code-tag {
    border-color: rgba(20, 30, 60, 0.28);
    background: rgba(79, 111, 255, 0.06);
}

body.light-mode .giftcode-item:hover,
body.light-mode .code-tag:hover {
    border-color: rgba(79, 111, 255, 0.34);
    background: rgba(79, 111, 255, 0.09);
}

@media (max-width: 768px) {
    .tool-main {
        padding-top: 20px;
    }

    .card {
        padding: 18px;
        border-radius: 20px;
    }

    .action-group,
    .filter-row {
        flex-direction: column;
    }

    .action-group .btn,
    button {
        width: 100%;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .footer-simple-tool {
        min-height: 44px;
        gap: 10px;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .brand-name {
        font-size: 0.94rem;
    }

    .brand-subline {
        font-size: 0.72rem;
    }
}

/* ===== Result Section Upgrade ===== */
.result-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(99, 102, 241, 0.10);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
}

body:not(.light-mode) .result-card {
    border-color: rgba(148, 163, 184, 0.10);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28), 0 4px 14px rgba(0, 0, 0, 0.18);
}

.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.result-title {
    margin: 0 0 10px;
    font-size: 20px;
    line-height: 1.2;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(148, 163, 184, 0.10);
}

.result-pill strong {
    font-weight: 700;
}

.result-pill-progress { color: var(--text); }
.result-pill-success { color: var(--tool-success); background: rgba(34, 197, 94, 0.10); border-color: rgba(34, 197, 94, 0.22); }
.result-pill-fail { color: var(--tool-fail); background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.22); }

.result-progress {
    height: 8px;
    margin-bottom: 16px;
    background: rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    overflow: hidden;
}

.result-progress .progress-bar {
    border-radius: 999px;
    transition: width 0.35s ease;
    background: linear-gradient(90deg, #6366f1 0%, #3b82f6 100%);
}

.result-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
}

.result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.result-table thead th {
    position: sticky;
    top: 0;
    background: rgba(99, 102, 241, 0.06);
    backdrop-filter: blur(8px);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

body:not(.light-mode) .result-table thead th {
    background: rgba(255, 255, 255, 0.04);
}

.result-table tbody td {
    padding: 14px;
    vertical-align: top;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.result-table tbody tr:last-child td {
    border-bottom: none;
}

.result-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.035);
}

body:not(.light-mode) .result-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.result-account {
    line-height: 1.6;
}

.result-uid {
    font-weight: 700;
    font-size: 14px;
}

.result-name {
    margin-top: 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.result-sub {
    font-size: 13px;
    color: #64748b;
}

body:not(.light-mode) .result-sub {
    color: #94a3b8;
}

.result-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step {
    margin-bottom: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.step-success {
    background: rgba(34, 197, 94, 0.10);
    border-color: rgba(34, 197, 94, 0.18);
}

.step-fail {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.18);
}

.step-running {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.18);
}

.step-retry {
    background: rgba(167, 139, 250, 0.10);
    border-color: rgba(167, 139, 250, 0.22);
}

.step-badge-retry {
    color: #7c3aed;
    background: rgba(167, 139, 250, 0.18);
    border-color: rgba(167, 139, 250, 0.30);
}

.step-error {
    margin-top: 4px;
    padding-left: 22px;
    font-size: 12px;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .result-card {
        padding: 14px;
    }

    .result-title {
        font-size: 18px;
    }

    .result-meta {
        gap: 6px;
    }

    .result-pill {
        font-size: 12px;
        padding: 6px 10px;
    }

    .result-table thead th,
    .result-table tbody td {
        padding: 12px 10px;
    }
}



/* ===== Result summary refresh ===== */

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.result-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

body.light-mode .result-stat {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.92));
    border-color: rgba(99, 102, 241, 0.12);
    box-shadow:
        0 8px 18px rgba(40, 55, 90, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.result-stat-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.result-stat-value {
    font-size: 1.1rem;
    line-height: 1.1;
    color: var(--text);
}

.result-stat-progress {
    border-color: rgba(99, 102, 241, 0.18);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.10), rgba(99, 102, 241, 0.04));
}

.result-stat-success {
    border-color: rgba(34, 197, 94, 0.20);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.10), rgba(34, 197, 94, 0.04));
}

.result-stat-success .result-stat-value {
    color: var(--tool-success);
}

.result-stat-fail {
    border-color: rgba(239, 68, 68, 0.20);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.10), rgba(239, 68, 68, 0.04));
}

.result-stat-fail .result-stat-value {
    color: var(--tool-fail);
}

body.light-mode .result-stat-progress {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03));
}
body.light-mode .result-stat-success {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.03));
}
body.light-mode .result-stat-fail {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.03));
}

/* ===== Step line refinement ===== */

.step {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 6px;
    line-height: 1.6;
}

.step-icon {
    width: 18px;
    flex: 0 0 18px;
    text-align: center;
    margin-right: 0;
    margin-top: 1px;
}

.step-line {
    min-width: 0;
    flex: 1;
}

.step-text {
    font-weight: 700;
}

.step-error {
    display: inline;
    margin: 0;
    padding: 0;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

@media (max-width: 640px) {
    .result-stat {
        padding: 10px 12px;
        border-radius: 14px;
    }

    .result-stat-value {
        font-size: 1rem;
    }
}


@media (max-width: 640px) {
    .step {
        align-items: flex-start;
        gap: 8px;
        padding: 9px 10px;
    }

    .step-line {
        flex-wrap: wrap;
    }

    .step-error {
        white-space: normal;
    }
}


@media (max-width: 640px) {
    .result-table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .result-table,
    .result-table thead,
    .result-table tbody,
    .result-table tr,
    .result-table th,
    .result-table td {
        display: block;
        width: 100% !important;
    }

    .result-table thead {
        display: none;
    }

    .result-table tbody {
        display: grid;
        gap: 12px;
    }

    .result-table tbody tr {
        border: 1px solid rgba(148, 163, 184, 0.16);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.03);
        overflow: hidden;
    }

    body.light-mode .result-table tbody tr {
        background: rgba(79, 111, 255, 0.04);
    }

    .result-table tbody td {
        padding: 12px;
        border: 0;
    }

    .result-table tbody td:first-child {
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    }

    .result-table tbody td:last-child {
        padding-top: 10px;
    }

    .step-line {
        display: block;
        width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        overflow-wrap: anywhere;
        word-break: break-word;
        min-width: 0;
    }

    .step-text,
    .step-error,
    .result-uid,
    .result-name {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .step-error {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
}