@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600&display=swap');

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

:root {
    --accent: #d45d0a;

    --bg: #f4f4f2;
    --bg-card: #ffffff;
    --bg-raised: #f0f0ee;
    --bg-hover: #e8e8e5;

    --border-md: rgba(0, 0, 0, 0.11);
    --border-strong: rgba(0, 0, 0, 0.17);

    --text-1: #1a1a1a;
    --text-2: #6b6b6b;

    transition: background 0.2s, color 0.2s;
}

[data-theme="dark"] {
    --accent: #e07830;

    --bg: #171717;
    --bg-card: #1c1c1c;
    --bg-raised: #242424;
    --bg-hover: #2a2a2a;

    --border-md: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.15);

    --text-1: #f2f2f2;
    --text-2: #9a9a9a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.2s, color 0.2s;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-md);
    border-radius: 12px;
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ── Theme toggle ─────────────────────────────────────────────────────────── */
#theme-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--bg-raised);
    border: 1px solid var(--border-md);
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}

#theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-1);
}

/* ── Shell / layout ───────────────────────────────────────────────────────── */
.shell {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Main card ────────────────────────────────────────────────────────────── */
main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-md);
    border-radius: 12px;
    padding: 20px;
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── URL input row ────────────────────────────────────────────────────────── */
.url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#url-input {
    flex: 1;
    font-family: inherit;
    font-size: 16px;
    color: var(--text-1);
    background: var(--bg-raised);
    border: 1px solid var(--border-md);
    border-radius: 8px;
    padding: 9px 13px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#url-input::placeholder {
    color: var(--text-2);
    opacity: 0.6;
}

#url-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 93, 10, 0.12);
}

.btn-clear {
    padding: 9px 12px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-2);
    background: var(--bg-raised);
    border: 1px solid var(--border-md);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    flex-shrink: 0;
}

.btn-clear:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-1);
}

/* ── Format grid ──────────────────────────────────────────────────────────── */
.format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.fmt-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 13px 8px;
    background: var(--bg-raised);
    border: 1px solid var(--border-md);
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    color: var(--text-2);
}

.fmt-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-1);
}

.fmt-btn.active {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--text-1);
    box-shadow: 0 0 0 1px var(--accent);
}

.fmt-icon {
    font-size: 17px;
    line-height: 1;
}

.fmt-title {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.fmt-desc {
    font-size: 10px;
    color: var(--text-2);
    text-align: center;
    line-height: 1.3;
}

/* ── Download button ──────────────────────────────────────────────────────── */
.btn-download {
    margin-top: 16px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

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

.btn-download:active {
    transform: translateY(0);
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Status box ───────────────────────────────────────────────────────────── */
.status-box {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--bg-card);
    border: 1px solid var(--border-md);
    border-radius: 10px;
    padding: 11px 15px;
    font-size: 12px;
    color: var(--text-2);
    min-height: 42px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-2);
    flex-shrink: 0;
    opacity: 0.4;
    transition: background 0.2s, opacity 0.2s;
}

.status-box.pending .status-dot {
    background: var(--accent);
    opacity: 1;
    animation: pulse 1.2s infinite;
}

.status-box.success .status-dot {
    background: #2d8a4e;
    opacity: 1;
}

.status-box.error .status-dot {
    background: #c0392b;
    opacity: 1;
}

@keyframes pulse {
    0%,  100% { opacity: 1; }
    50%        { opacity: 0.3; }
}

/* ── Logo ─────────────────────────────────────────────────────────────────── */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-glyph {
    font-size: 20px;
    line-height: 1;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
}

.logo-sub {
    font-size: 10px;
    color: var(--text-2);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-2);
    padding: 4px 0;
}

.footer-sep {
    color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        padding: 8px;
        gap: 6px;
    }

    header {
        padding: 8px 12px;
    }

    .card {
        padding: 14px;
    }

    .card-label {
        margin-bottom: 6px;
    }

    .card-label + * {
        margin-top: 0;
    }

    .btn-download {
        margin-top: 12px;
    }

    .status-box {
        min-height: 38px;
        padding: 9px 13px;
    }

    footer {
        padding: 2px 0;
    }
}

@media (max-width: 480px) {
    body {
        gap: 5px;
    }

    .format-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .fmt-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 9px 12px;
        gap: 10px;
    }

    .fmt-desc {
        text-align: left;
    }
}