:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-focus: #bfdbfe;
    --text-main: #334155;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --input-bg: #f8fafc;
    --btn-disabled-bg: #e2e8f0;
    --btn-disabled-text: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-input: 12px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --non-zero: #1e3a8a;
    --non-zero-soft: rgba(30, 58, 138, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text-main);
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 640px;
}

/* Header / Hero */
.hero {
    text-align: center;
    margin-bottom: 32px;
}

.logo-box {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    font-size: 32px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    margin: 0 auto 16px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.hero h1 {
    font-size: 28px;
    margin: 0 0 8px 0;
    background: linear-gradient(90deg, #4f46e5, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.hero p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
    letter-spacing: 1px;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 15px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.1);
}

.tab-btn:hover:not(.active) {
    background: #ffffff;
    color: var(--primary);
}

/* Card */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
}

.card-title {
    font-size: 20px;
    font-weight: bold;
    margin: 0 0 8px;
    color: #1e293b;
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 28px;
}

/* Forms */
.field {
    margin-bottom: 24px;
}

.field label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    color: #475569;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: stretch;
    /* Make input and button same height */
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}

input:focus {
    border-color: var(--border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.3);
}

textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

textarea:focus {
    border-color: var(--border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.3);
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-input);
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e1;
    color: #1e293b;
}

.btn:hover:not(:disabled):not(.btn-secondary) {
    background: var(--primary-hover);
}

.btn:disabled {
    background: var(--btn-disabled-bg);
    color: var(--btn-disabled-text);
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

/* Note Hint */
.input-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Notice / Results */
.result-box {
    margin-top: 24px;
    padding: 16px;
    border-radius: var(--radius-input);
    font-size: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    line-height: 1.5;
}

.result-box[hidden] {
    display: none;
}

.result-box.success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.result-box.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.result-box.info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.result-box.warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

/* Status colors */
.text-bound {
    color: var(--success);
    font-weight: bold;
}

.text-unbound {
    color: var(--warning);
    font-weight: bold;
}

.text-binding {
    color: #a855f7;
    font-weight: bold;
}

.text-pending {
    color: var(--danger);
    font-weight: bold;
}

/* Two step indicator */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    gap: 12px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.step-dot.active {
    background: var(--primary);
    width: 32px;
    border-radius: 4px;
}

.locked-input {
    background: #e2e8f0 !important;
    color: #64748b !important;
    cursor: not-allowed;
    border-color: #cbd5e1 !important;
}

/* GitHub style board */
.contrib-wrapper {
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.contrib-graph {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    grid-template-columns: repeat(12, 12px);
    grid-auto-flow: row;
    gap: 3px;
    justify-content: start;
}

.contrib-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: #ebedf0;
    box-shadow: inset 0 0 0 1px rgba(27, 31, 35, 0.06);
    transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.contrib-cell.bound {
    background: #16a34a;
    box-shadow: inset 0 0 0 1px rgba(22, 101, 52, 0.22);
}

.contrib-cell.unbound {
    background: #eab308;
    box-shadow: inset 0 0 0 1px rgba(133, 77, 14, 0.16);
}

.contrib-cell.binding {
    background: #a855f7;
    box-shadow: inset 0 0 0 1px rgba(107, 33, 168, 0.16);
}

.contrib-cell.pending {
    background: #dc2626;
    box-shadow: inset 0 0 0 1px rgba(127, 29, 29, 0.2);
}

.contrib-cell:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

/* Board details summary */
.board-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.board-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.board-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex: 0 0 auto;
}

.board-dot.bound {
    background: #16a34a;
}

.board-dot.unbound {
    background: #eab308;
}

.board-dot.binding {
    background: #a855f7;
}

.board-dot.pending {
    background: #dc2626;
}

.board-dot.non_zero {
    background: var(--non-zero);
}

@media (max-width: 600px) {
    .card {
        padding: 24px;
    }

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

    .input-group .btn {
        width: 100%;
    }

    .board-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Toast */
#toastStack {
    position: fixed;
    top: 20px;
    right: 20px;
    display: grid;
    gap: 10px;
    z-index: 9999;
}

.toast {
    min-width: 200px;
    padding: 12px 16px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s ease 2.7s forwards;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(110%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(10%);
    }
}

.text-non-zero {
    color: var(--non-zero);
    font-weight: bold;
}

.contrib-cell.non_zero {
    background-color: var(--non-zero);
    box-shadow: inset 0 0 0 1px var(--non-zero-soft);
}

.footer-note {
    text-align: center;
    padding: 20px 0 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-note p {
    margin: 0;
}