/* ================================================================
   Reset & Base
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:           #f6f8fa;
    --surface:      #ffffff;
    --border:       #d0d7de;
    --border-focus: #0969da;
    --text:         #1f2328;
    --muted:        #656d76;
    --blue:         #0969da;
    --blue-bg:      #ddf4ff;
    --blue-hover:   #0550ae;
    --green:        #1a7f37;
    --green-bg:     #dafbe1;
    --green-hover:  #116329;
    --red:          #cf222e;
    --red-bg:       #ffebe9;
    --radius:       8px;
    --mono:         'SFMono-Regular','Consolas','Liberation Mono',Menlo,monospace;
}

body {
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans',Helvetica,Arial,sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 32px 16px 80px;
    line-height: 1.5;
    font-size: 14px;
}

.container { max-width: 640px; margin: 0 auto; }

/* ================================================================
   Header
   ================================================================ */
.site-header {
    text-align: center;
    padding-bottom: 32px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-family: var(--mono);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--blue);
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.site-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--muted);
    font-size: .875rem;
}

/* ================================================================
   Form
   ================================================================ */
.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(31,35,40,.06);
}

.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.url-field {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.url-field:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(9,105,218,.12);
    background: #fff;
}
.url-field::placeholder { color: var(--muted); }

.hint {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* ================================================================
   Buttons
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: background .12s, border-color .12s, box-shadow .12s, transform .08s;
    line-height: 1.4;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-icon { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
    background: var(--blue);
    border-color: rgba(0,0,0,.1);
    color: #fff;
    box-shadow: 0 1px 0 rgba(31,35,40,.1), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-download {
    background: var(--green);
    border-color: rgba(0,0,0,.1);
    color: #fff;
    font-size: 15px;
    padding: 11px 28px;
    margin-top: 4px;
    box-shadow: 0 1px 0 rgba(31,35,40,.1), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-download:hover { background: var(--green-hover); box-shadow: 0 3px 10px rgba(26,127,55,.3); }

.btn-link {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 8px;
    padding: 4px 0;
    display: block;
    text-align: center;
    width: 100%;
}
.btn-link:hover { color: var(--text); }

/* ================================================================
   Progress
   ================================================================ */
.progress-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(31,35,40,.06);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.progress-site {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85%;
}

.progress-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.progress-track {
    height: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: 50px;
    width: 0%;
    background: linear-gradient(90deg, #0969da 0%, #388bfd 50%, #79c0ff 100%);
    background-size: 200% 100%;
    transition: width .4s ease;
    animation: shimmer 1.8s linear infinite;
}

@keyframes shimmer {
    0%   { background-position:  200% center; }
    100% { background-position: -200% center; }
}

.progress-msg {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

/* ================================================================
   Result cards (success / error)
   ================================================================ */
.result-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(31,35,40,.06);
}

.result-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.result-icon svg { width: 26px; height: 26px; }

.success-icon { background: var(--green-bg); color: var(--green); border: 2px solid rgba(26,127,55,.25); }
.error-icon   { background: var(--red-bg);   color: var(--red);   border: 2px solid rgba(207,34,46,.25);  }

.result-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.result-url {
    font-size: 13px;
    color: var(--muted);
    font-family: var(--mono);
    margin-bottom: 18px;
    word-break: break-all;
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.stat-item { text-align: center; }

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.error-msg {
    font-size: 13px;
    color: var(--red);
    background: var(--red-bg);
    border: 1px solid rgba(207,34,46,.3);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    text-align: left;
    line-height: 1.5;
}

/* ================================================================
   Footer
   ================================================================ */
.site-footer {
    text-align: center;
    margin-top: 40px;
    font-size: 12px;
    color: var(--muted);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ================================================================
   Utility
   ================================================================ */
.hidden { display: none !important; }

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 520px) {
    body { padding: 16px 12px 60px; }
    .input-row { flex-direction: column; }
    .btn-primary { justify-content: center; }
    .stats-grid { gap: 16px; }
}
