:root {
    --bg-main: #0e0e12;
    --bg-panel: #18181f;
    --bg-input: #222230;
    --border: #2e2e3a;
    --border-hover: #4a4a60;
    --text-main: #ededed;
    --text-muted: #9090a8;
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-glow: rgba(129, 140, 248, 0.18);
    --success: #34d399;
    --error: #ef4444;
    --radius: 8px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 4rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Typography */
h1, h2, h3 {
    color: #ffffff;
    font-weight: 600;
}

h1 {
    font-size: 2.4rem;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    line-height: 1.15;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.ghost-text {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

.tiny-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: block;
}

.monospace {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.error-text {
    color: var(--error) !important;
}

/* Layout */
.top-nav {
    border-bottom: 1px solid var(--border);
    background: rgba(14, 14, 18, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.85rem 0;
    margin-bottom: 3rem;
}

.nav-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

.logo:hover {
    text-decoration: none;
    color: #ffffff;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-main);
    text-decoration: none;
}

.nav-icon {
    width: 14px;
    height: 14px;
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-footer {
    max-width: 680px;
    margin: 4rem auto 0;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-heart {
    width: 13px;
    height: 13px;
    color: #f472b6;
    vertical-align: -0.1em;
}

.section-icon {
    width: 16px;
    height: 16px;
    vertical-align: -0.2em;
    margin-right: 0.25rem;
    color: var(--text-muted);
}

.tiny-icon {
    width: 12px;
    height: 12px;
    vertical-align: -0.15em;
    margin-right: 0.2rem;
}

/* Forms & Inputs */
.input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.85rem;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.input-wrapper input {
    padding-left: 2.5rem !important;
}

input[type="text"] {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

button {
    background-color: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.2s;
}

button:hover:not(:disabled) {
    background-color: var(--border);
    border-color: var(--border-hover);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button.is-loading {
    animation: pulse 1.5s infinite;
}

.btn-icon {
    width: 15px;
    height: 15px;
    vertical-align: -0.15em;
}

.btn-icon-sm {
    width: 13px;
    height: 13px;
    vertical-align: -0.15em;
}

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

.primary-btn {
    display: inline-block;
    background-color: var(--primary);
    color: #111;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    color: #111;
    text-decoration: none;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}
.text-btn:hover {
    background: transparent;
    text-decoration: underline;
}

/* Hero */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-glow);
    border: 1px solid rgba(129, 140, 248, 0.25);
    border-radius: 99px;
    padding: 0.3rem 0.75rem;
    margin-bottom: 1rem;
}

.hero-badge-icon {
    width: 13px;
    height: 13px;
}

.gradient-text {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 55%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.main-form .input-wrapper {
    flex: 1;
}

.main-form input {
    width: 100%;
}

.lookup-section {
    margin-top: 2.5rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0.8;
}

.lookup-section input {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.lookup-section button {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Status Panel */
.status-panel, .history-section {
    margin-top: 3rem;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.hidden {
    display: none !important;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.status-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

.status-badge-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: var(--border);
    color: var(--text-main);
}

.status-pill.completed {
    background-color: rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.status-pill.failed {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.error-box {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.message-box {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

/* Progress */
.progress-section {
    margin-bottom: 1.5rem;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.small-labels {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-bg.thin {
    height: 4px;
}

#progress-bar, #download-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #c084fc 100%);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(129, 140, 248, 0.5);
}

#download-progress-bar {
    background: linear-gradient(90deg, var(--text-muted) 0%, #818cf8 100%);
    box-shadow: none;
}

/* Stages */
.stages {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.stage-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.stage-icon {
    width: 12px;
    height: 12px;
}

.stage-chip.is-active {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--primary-glow);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.stage-chip.is-complete {
    border-color: var(--success);
    color: var(--success);
    background-color: rgba(52, 211, 153, 0.08);
}

.download-wrap {
    margin: 2rem 0;
    text-align: center;
}

.turnstile-wrapper {
    margin-top: 0.75rem;
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.data-group h3 {
    margin-bottom: 1rem;
}

.row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    border-bottom: 1px dashed var(--border);
}

.row:last-child {
    border-bottom: none;
}

.row span {
    color: var(--text-muted);
}

.row strong {
    font-weight: 500;
}

/* Events Log */
.events-section {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

#activity-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

#activity-list li {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.25rem 0;
    border-left: 2px solid var(--border);
    padding-left: 0.75rem;
    margin-bottom: 0.25rem;
}

#activity-list li:first-child {
    border-left-color: var(--primary);
    color: var(--text-main);
}

/* History */
#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.history-username {
    font-weight: 600;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-job {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.history-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
}

.history-btn:hover {
    border-color: var(--text-muted);
    background-color: var(--bg-input);
}

/* Responsive */
@media (max-width: 600px) {
    .main-form {
        flex-direction: column;
    }

    h1 {
        font-size: 2rem;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}