/* AIMarket — Polymarket-style card grid with varied layouts */

:root {
    --bg: #f2f4f6;
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --faint: #9ca3af;
    --green: #22c55e;
    --green-bg: #dcfce7;
    --green-light: #f0fdf4;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --red-light: #fef2f2;
    --blue: #3b82f6;
    --blue-bg: #dbeafe;
    --purple: #8b5cf6;
    --purple-bg: #ede9fe;
    --orange: #f97316;
    --orange-bg: #ffedd5;
    --pink: #ec4899;
    --pink-bg: #fce7f3;
    --teal: #14b8a6;
    --teal-bg: #ccfbf1;
    --indigo: #6366f1;
    --indigo-bg: #e0e7ff;
    --amber: #f59e0b;
    --amber-bg: #fef3c7;
    --cyan: #06b6d4;
    --cyan-bg: #cffafe;
    --lime: #84cc16;
    --lime-bg: #ecfccb;
    --overlay-bg: rgba(0, 0, 0, 0.3);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow: hidden;
}

/* Card wall */
.card-wall {
    padding: 1rem;
    filter: brightness(0.88);
    pointer-events: none;
}

/* Site header */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.header-logo {
    width: 2.75rem;
    height: 2.75rem;
    display: block;
    object-fit: contain;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.header-brand-name {
    font-size: 1.125rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    line-height: 1;
}

.header-brand-text .brand-agent {
    color: var(--text);
}

.brand-tagline {
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-top: 0.125rem;
}

.header-btn {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.header-btn-ghost {
    border: 1px solid var(--card-border);
    background: #fff;
    color: var(--text);
}

.header-btn-ghost:hover {
    background: var(--bg);
}

.header-btn-primary {
    border: 1px solid #000;
    background: #000;
    color: #fff;
}

.header-btn-primary:hover {
    background: #22c55e;
    border-color: #22c55e;
    color: #000;
}

/* Category tabs */
.tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0;
    white-space: nowrap;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: var(--text);
    border-bottom-color: #22c55e;
    font-weight: 600;
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.875rem;
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* Base card */
.m-card {
    background: linear-gradient(160deg, #ffffff 0%, #e8ecf1 100%);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

.m-top {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.m-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.m-meta { flex: 1; min-width: 0; }

.m-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.m-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.m-tag {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
}

.m-live {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.m-live::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    background: #dc2626;
    border-radius: 50%;
    display: inline-block;
}

/* Date-based card */
.m-outcomes-date {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex: 1;
}

.m-row-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.m-date-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    min-width: 6rem;
}

.m-date-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.m-date-bar {
    height: 0.5rem;
    background: var(--green);
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.m-date-pct {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--green);
    min-width: 2.5rem;
    text-align: right;
}

/* Binary card */
.m-outcomes-binary {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex: 1;
}

.m-btn-up, .m-btn-down {
    flex: 1;
    padding: 0.625rem 0.625rem 0.375rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.375rem;
    overflow: hidden;
}

.m-btn-up {
    background: var(--green-bg);
    color: var(--green);
}

.m-btn-down {
    background: var(--red-bg);
    color: var(--red);
}

.m-btn-up span, .m-btn-down span {
    display: block;
    font-size: 1.125rem;
    font-weight: 800;
    margin-top: 0.125rem;
}

.m-btn-bar {
    height: 0.25rem;
    border-radius: 0.125rem;
    flex-shrink: 0;
}

.m-btn-up .m-btn-bar {
    background: var(--green);
}

.m-btn-down .m-btn-bar {
    background: var(--red);
}

/* Multi candidate */
.m-outcomes-multi {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
    flex: 1;
}

.m-row-multi {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.m-multi-name {
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 6rem;
    flex-shrink: 0;
}

.m-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.m-bar {
    height: 0.5rem;
    border-radius: 0.25rem;
    flex-shrink: 0;
    background: var(--green);
    min-width: 2px;
}

.m-multi-pct {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    min-width: 2.5rem;
    text-align: right;
    flex-shrink: 0;
}

.m-row-multi:nth-child(2) .m-bar { background: var(--blue); }
.m-row-multi:nth-child(3) .m-bar { background: var(--purple); }
.m-row-multi:nth-child(4) .m-bar { background: var(--orange); }
.m-row-multi:nth-child(5) .m-bar { background: var(--pink); }

.m-multi-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.m-mini-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--blue-bg);
    color: var(--blue);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Chance card */
.m-chance {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex: 1;
}

.m-chance-ring {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    border: 3px solid var(--green);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.m-chance-pct {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.m-chance-label {
    font-size: 0.625rem;
    color: var(--faint);
    text-transform: uppercase;
}

.m-chance-buttons {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.m-chance-buttons .m-btn-up,
.m-chance-buttons .m-btn-down {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Card footer */
.m-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.m-vol {
    font-size: 0.6875rem;
    color: var(--faint);
    font-weight: 500;
}

.m-status {
    font-size: 0.6875rem;
    color: var(--faint);
    font-weight: 500;
}

/* ========== MODAL (Diagonal Cut) ========== */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: var(--overlay-bg);
    padding: 1.5rem;
    z-index: 10;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-wrap {
    width: 100%;
    max-width: 640px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.modal {
    width: 100%;
    min-height: 280px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 3px #000;
    position: relative;
    background: #000;
}

.diag {
    position: absolute;
    top: 0;
    right: 0;
    width: 52%;
    height: 100%;
    background: #22c55e;
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
    z-index: 1;
}

.modal-content {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    min-height: 280px;
}

.modal-left {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
    align-self: flex-start;
}

.modal-logo {
    width: 70px;
    height: auto;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-brand-name {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    line-height: 1;
}

.brand-agent {
    color: #fff;
}

.brand-bets {
    color: #22c55e;
}

.modal-brand-tagline {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: #22c55e;
    margin-top: 0.375rem;
}

.modal-brand {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #22c55e;
    margin-bottom: 1rem;
}

.modal-headline {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: #fff;
    text-transform: uppercase;
}

@media (min-width: 640px) {
    .modal-headline { font-size: 3.25rem; }
}

.modal-right {
    width: 45%;
    padding: 1.5rem 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.modal-sub {
    font-size: 1.125rem;
    color: #000;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.modal-form { margin-bottom: 1rem; }

.signup {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.signup input[type="email"] {
    flex: 1;
    width: 100%;
    border: 2px solid #000;
    border-radius: 0.5rem;
    background: #fff;
    color: #000;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    outline: none;
}

.signup input[type="email"]::placeholder { color: #666; }

.signup button {
    border: 0;
    border-radius: 0.5rem;
    background: #000;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform 0.15s;
}

.signup button:hover { transform: scale(1.02); }

.signup button:disabled { opacity: 0.6; cursor: default; }

.hp { display: none; }

.status {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    min-height: 1.25rem;
    color: #000;
    font-weight: 600;
}

.status:empty { display: none; }
.status.err { color: #dc2626; }

.signup-done {
    color: #000;
    font-size: 1.125rem;
    font-weight: 700;
    padding: 0.75rem 0;
}

.modal-fine {
    font-size: 0.75rem;
    color: rgba(0,0,0,0.7);
    line-height: 1.5;
    font-weight: 500;
}

.modal-fine-below {
    text-align: center;
    margin-top: 0.75rem;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.75rem;
    line-height: 1.4;
    font-weight: 500;
}

.modal-fine a {
    color: #000;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 700;
}

.modal-fine-below a {
    color: #fff;
}

/* Mobile modal */
@media (max-width: 640px) {
    .site-header {
        padding: 0.5rem 0.75rem;
    }
    .header-logo {
        width: 2.25rem;
        height: 2.25rem;
    }
    .header-brand-name {
        font-size: 1rem;
    }
    .brand-tagline {
        font-size: 0.5rem;
    }
    .header-btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
    }
    .overlay {
        padding: 0.75rem 0.75rem 1rem;
    }
    .modal-wrap {
        max-width: 380px;
        margin: auto;
    }
    .modal {
        flex-direction: column;
        min-height: auto;
        border-radius: 0.875rem;
        box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4), 0 0 0 2px #000;
    }
    .diag {
        display: none;
    }
    .modal-content {
        flex-direction: column;
        min-height: auto;
    }
    .modal-left {
        padding: 1.25rem 1.25rem 0.875rem;
        align-items: center;
        text-align: center;
        background: #000;
    }
    .modal-branding {
        margin-bottom: 0.625rem;
        align-self: center;
    }
    .modal-logo {
        width: 44px;
        margin-bottom: 0.25rem;
    }
    .modal-brand-name {
        font-size: 1.35rem;
    }
    .modal-brand-tagline {
        font-size: 0.5625rem;
        margin-top: 0.25rem;
    }
    .modal-headline {
        font-size: clamp(1.45rem, 6.2vw, 1.85rem);
        line-height: 0.95;
        text-align: center;
    }
    .modal-right {
        width: 100%;
        background: #22c55e;
        clip-path: polygon(0 14px, 100% 0, 100% 100%, 0 100%);
        margin-top: -8px;
        padding: 1.5rem 1.25rem 1.25rem;
        text-align: center;
    }
    .modal-sub {
        font-size: 0.9375rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
        color: #000;
        font-weight: 700;
        text-align: center;
    }
    .signup {
        gap: 0.5rem;
    }
    .signup input[type="email"] {
        padding: 0.75rem 0.875rem;
        font-size: 16px;
    }
    .signup button {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
    .modal-fine-below {
        font-size: 0.6875rem;
        margin-top: 0.625rem;
        max-width: 320px;
    }
}
