:root {
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-light: rgba(99, 102, 241, 0.2);
    --secondary: #10b981; /* Emerald 500 */
    --accent: #8b5cf6; /* Violet 500 */
    --bg-dark: #09090b; /* Zinc 950 */
    --bg-card: rgba(24, 24, 27, 0.6); /* Zinc 900 with opacity */
    --text-main: #f4f4f5; /* Zinc 100 */
    --text-muted: #a1a1aa; /* Zinc 400 */
    --border-color: rgba(255, 255, 255, 0.08);
    --error: #ef4444; /* Red 500 */
    --error-bg: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --bit-bg: #18181b;
    --bit-border: rgba(255, 255, 255, 0.15);
    --bit-text: #e4e4e7;
    --bit-glow: rgba(99, 102, 241, 0.5);
    --font-main: 'Outfit', 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs for Modern Aesthetic */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    border-radius: 50%;
    animation: float 20s ease-in-out infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(99,102,241,0.4) 0%, rgba(99,102,241,0) 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, rgba(139,92,246,0) 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Typography & Headers */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.6);
    color: white;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Cards & Layout */
.grid-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-wrapper {
        grid-template-columns: 3fr 2fr;
    }
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.6s ease-out both;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.badge {
    background: var(--primary-light);
    color: #a5b4fc;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #e4e4e7;
    font-size: 0.95rem;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: #a1a1aa;
    font-size: 10px;
    margin-left: 6px;
    cursor: help;
    transition: all 0.2s;
}

.tooltip-icon:hover {
    background: var(--primary);
    color: white;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1.1rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    background: rgba(0, 0, 0, 0.4);
}

.form-group input[type="text"]::placeholder {
    color: #52525b;
    letter-spacing: normal;
}

.bit-counter {
    position: absolute;
    right: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 6px;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

/* Mode Selector (Radio Buttons) */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mode-btn {
    cursor: pointer;
}

.mode-btn input[type="radio"] {
    display: none;
}

.mode-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.mode-btn input[type="radio"]:checked + .mode-content {
    background: var(--primary-light);
    border-color: var(--primary);
    color: white;
    box-shadow: inset 0 0 0 1px var(--primary);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    flex: 2;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.8);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    flex: 1;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-outline {
    background-color: transparent;
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.5);
}

.btn-outline:hover {
    background-color: var(--primary-light);
    color: white;
}

.full-width {
    width: 100%;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.alert-error {
    background-color: var(--error-bg);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-error::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23fca5a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    flex-shrink: 0;
}


.hidden {
    display: none !important;
}

/* Bit Display Visuals */
.result-box {
    text-align: center;
}

.result-box h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.bit-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: center;
}

.bit-box {
    width: 2.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bit-bg);
    border: 1px solid var(--bit-border);
    border-radius: 8px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--bit-text);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
    position: relative;
    overflow: hidden;
}

.bit-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.highlight-container .bit-box {
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 15px var(--primary-light), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(99,102,241,0.1) 0%, rgba(0,0,0,0) 100%);
}

.bit-box:nth-child(1) { animation-delay: 0.05s; }
.bit-box:nth-child(2) { animation-delay: 0.1s; }
.bit-box:nth-child(3) { animation-delay: 0.15s; }
.bit-box:nth-child(4) { animation-delay: 0.2s; }
.bit-box:nth-child(5) { animation-delay: 0.25s; }
.bit-box:nth-child(6) { animation-delay: 0.3s; }
.bit-box:nth-child(7) { animation-delay: 0.35s; }
.bit-box:nth-child(8) { animation-delay: 0.4s; }
.bit-box:nth-child(9) { animation-delay: 0.45s; }
.bit-box:nth-child(10) { animation-delay: 0.5s; }

.bit-group-separator {
    width: 0.5rem;
}

/* Timeline & Steps Layout */
.steps-header {
    text-align: center;
    margin-bottom: 2rem;
}

.steps-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

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

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--accent), transparent);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2.75rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    z-index: 2;
}

.step-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.step-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(24, 24, 27, 0.8);
}

.step-card h3 {
    color: #c7d2fe;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.step-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.step-details {
    font-size: 0.95rem;
}

/* Ensure step logs from JS look good in dark mode */
.step-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.step-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.step-label {
    color: #d4d4d8;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    font-weight: 500;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Responsive */
@media (max-width: 640px) {
    header h1 { font-size: 2.25rem; }
    
    .action-buttons { flex-direction: column; }
    
    .timeline { padding-left: 1.5rem; }
    
    .timeline-marker { left: -2.25rem; width: 1.5rem; height: 1.5rem; font-size: 0.7rem; }
    
    .bit-box { width: 2rem; height: 2.75rem; font-size: 1.2rem; }
}

/* Fixes for inline styles generated by JS */
table { width: 100%; border-radius: 8px; overflow: hidden; }
td { border-color: rgba(255,255,255,0.1) !important; }
