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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f0f0f;
    color: #e8e8e8;
    min-height: 100vh;
    padding: 2rem 1rem;
}

main {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #888;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ── Form ─────────────────────────────────────────────── */

#form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

#url {
    flex: 1;
    padding: 0.65rem 1rem;
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    color: #e8e8e8;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
    min-width: 0;
}

#url:focus {
    border-color: #555;
}

button[type="submit"] {
    padding: 0.65rem 1.5rem;
    background: #e8e8e8;
    color: #0f0f0f;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}

button[type="submit"]:hover {
    background: #fff;
}

button[type="submit"]:disabled {
    background: #444;
    color: #777;
    cursor: not-allowed;
}

.options {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #888;
}

.options select,
.options input[type="number"] {
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 4px;
    color: #e8e8e8;
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
    outline: none;
}

.options input[type="number"] {
    width: 80px;
}

.custom-size {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.custom-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #e8e8e8;
    cursor: pointer;
}

.ua-label {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.3rem;
    width: 100%;
}

.ua-label input[type="text"] {
    width: 100%;
    padding: 0.3rem 0.5rem;
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 4px;
    color: #888;
    font-size: 0.75rem;
    font-family: monospace;
    outline: none;
    transition: border-color 0.15s, color 0.15s;
}

.ua-label input[type="text"]:focus {
    border-color: #555;
    color: #e8e8e8;
}

/* ── Status ───────────────────────────────────────────── */

.status {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.status.loading {
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status.error {
    background: #1f0e0e;
    border: 1px solid #5c1a1a;
    color: #f87171;
}

.hidden {
    display: none !important;
}

/* ── Spinner ──────────────────────────────────────────── */

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #444;
    border-top-color: #aaa;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ── Result ───────────────────────────────────────────── */

.result {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    color: #e8e8e8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
}

.action-btn:hover {
    background: #222;
    border-color: #444;
}

.action-btn.copied {
    border-color: #2a5c2a;
    color: #4ade80;
}

/* ── Redirect info ────────────────────────────────────── */

.redirect-info {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.5;
    word-break: break-all;
}

.redirect-info .hop {
    color: #666;
}

.redirect-info .hop + .hop::before {
    content: ' → ';
    color: #444;
}

.redirect-info .hop.final {
    color: #888;
}

.redirect-label {
    color: #555;
    margin-right: 0.25rem;
}

/* ── Image ────────────────────────────────────────────── */

.image-container {
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1a;
}

#screenshot {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 540px) {
    h1 {
        font-size: 1.5rem;
    }

    .input-row {
        flex-direction: column;
    }

    button[type="submit"] {
        width: 100%;
        padding: 0.75rem;
    }

    .options {
        gap: 0.75rem;
    }

    .options input[type="number"] {
        width: 75px;
    }

    .result-actions {
        gap: 0.4rem;
    }

    .action-btn {
        flex: 1;
        text-align: center;
    }
}
