:root {
    --bg: #07131f;
    --bg-deep: #030a11;
    --panel: rgba(8, 23, 38, 0.78);
    --panel-strong: rgba(9, 31, 52, 0.92);
    --line: rgba(126, 196, 255, 0.18);
    --text: #e8f2ff;
    --muted: #95a9c5;
    --hot: #ff8f3d;
    --gold: #ffd166;
    --teal: #5de2cc;
    --danger: #ff6b6b;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 143, 61, 0.16), transparent 28%),
        radial-gradient(circle at 80% 10%, rgba(93, 226, 204, 0.15), transparent 24%),
        linear-gradient(180deg, #0a1828 0%, #06111b 45%, #03070d 100%);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.5;
    min-height: 100vh;
}

.page-shell {
    position: relative;
    overflow: hidden;
    padding: 32px 24px 56px;
    max-width: 1480px;
    margin: 0 auto;
}

.background-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    pointer-events: none;
}

.orbit-a {
    width: 520px;
    height: 520px;
    right: -180px;
    top: -120px;
    animation: drift 24s linear infinite;
}

.orbit-b {
    width: 320px;
    height: 320px;
    left: -100px;
    bottom: 120px;
    animation: drift 18s linear infinite reverse;
}

.hero,
.panel {
    position: relative;
    backdrop-filter: blur(18px);
    background: linear-gradient(180deg, rgba(11, 31, 50, 0.88), rgba(6, 18, 31, 0.84));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "title"
        "copy"
        "chat";
    gap: 28px;
    border-radius: 28px;
    padding: 28px;
    margin-bottom: 24px;
    align-items: stretch;
}

.hero-title-row {
    grid-area: title;
}

.eyebrow,
.section-kicker {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--gold);
    margin: 0 0 10px;
}

.hero h1,
.panel h2,
.pick-card h3 {
    font-family: Georgia, "Times New Roman", serif;
    margin: 0;
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 4.2rem);
    line-height: 0.94;
    max-width: none;
}

.hero-copy {
    grid-area: copy;
    display: block;
    min-height: auto;
}

.hero-text,
.panel-subtitle,
.meta-note,
.fact-card p,
.history-card p,
.pick-item p,
.chat-bubble p {
    color: var(--muted);
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.auto-refresh-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.auto-refresh-interval {
    min-width: 120px;
}

.sportsbook-filter {
    display: grid;
    gap: 6px;
    min-width: 220px;
}

.sportsbook-filter span {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.sportsbook-filter select {
    width: 100%;
    background: rgba(0, 0, 0, 0.32);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}

.hero-facts {
    grid-area: chat;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.metric-tile,
.fact-card,
.history-card,
.pick-item,
.stat-tile {
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 16px;
}

.metric-tile strong,
.stat-tile strong {
    display: block;
    font-size: 1.8rem;
    margin-top: 10px;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.view-tabs {
    display: flex;
    gap: 10px;
    margin: 8px 0 18px;
    flex-wrap: wrap;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: grid;
}

.bet-tab-content {
    display: none;
}

.bet-tab-content.active {
    display: block;
}

.players-table-wrap {
    margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.02);
}

.players-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.players-table th,
.players-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    font-size: 0.92rem;
}

.players-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(7, 19, 31, 0.98);
    color: var(--gold);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.panel {
    border-radius: 24px;
    padding: 22px;
}

.panel-span-2 {
    grid-column: span 2;
}

.panel-header,
.card-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.pick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.pick-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 10px;
    margin-top: 14px;
    align-items: end;
}

.pick-control {
    display: grid;
    gap: 6px;
}

.pick-control span {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.pick-control input {
    width: 100%;
    background: rgba(0, 0, 0, 0.32);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}

.pick-control select {
    width: 100%;
    background: rgba(0, 0, 0, 0.32);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}

.pick-card {
    border-radius: 22px;
    padding: 18px;
    background:
        linear-gradient(160deg, rgba(255, 143, 61, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pick-list,
.stat-stack,
.facts-grid,
.history-grid,
.meta-stack,
.chat-messages {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.pick-item-title,
.fact-card strong,
.history-card strong {
    display: block;
    font-size: 1.08rem;
    margin-bottom: 6px;
    word-break: break-word;
}

.pick-item p,
.chat-bubble p {
    overflow-wrap: anywhere;
}

.legs-list {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag,
.count-chip,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel h2 {
    font-size: clamp(1.32rem, 1.8vw, 1.9rem);
}

.pick-card h3 {
    font-size: 1.15rem;
}

.status-pill.running {
    color: #101820;
    background: var(--gold);
}

.status-pill.completed {
    color: #06241d;
    background: var(--teal);
}

.status-pill.failed {
    background: var(--danger);
}

.primary-button,
.suggestion-chip {
    border: none;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--hot), #ffb347);
    color: #111;
    font-weight: 700;
    padding: 12px 18px;
    border-radius: 999px;
    box-shadow: 0 12px 40px rgba(255, 143, 61, 0.28);
}

.primary-button:hover,
.suggestion-chip:hover {
    transform: translateY(-1px);
}

.log-console,
.chat-input,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.32);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
}

.log-console {
    min-height: 260px;
    max-height: 420px;
    overflow: auto;
    padding: 16px;
    margin-top: 16px;
    font-family: "Courier New", monospace;
    font-size: 0.82rem;
    line-height: 1.4;
}

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

.hero-facts .facts-grid {
    grid-template-columns: 1fr;
}

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

.sparkline svg {
    width: 180px;
    height: 52px;
}

.history-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.history-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.history-chart-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 14px;
}

.history-chart {
    margin-top: 12px;
    min-height: 190px;
}

.history-chart svg {
    width: 100%;
    height: 180px;
}

.history-table-wrap {
    margin-top: 12px;
}

.history-table {
    min-width: 760px;
}

.history-row-action {
    cursor: pointer;
}

.history-row-action:hover {
    background: rgba(93, 226, 204, 0.08);
}

.history-detail-card {
    margin-top: 14px;
}

.history-inline-input,
.history-inline-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 8px;
    font: inherit;
    font-size: 0.82rem;
}

.history-inline-input {
    min-width: 86px;
}

.history-settle-btn,
.history-delete-btn {
    white-space: nowrap;
}

.history-delete-bundle-btn {
    margin-left: 8px;
}

.history-delete-btn {
    border-color: rgba(255, 107, 107, 0.55);
}

.history-delete-btn:hover {
    background: rgba(255, 107, 107, 0.18);
}

.suggestion-chip:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.chat-layout {
    display: grid;
    gap: 14px;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.suggestion-chip {
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.suggestion-chip.active {
    border-color: rgba(93, 226, 204, 0.65);
    background: rgba(93, 226, 204, 0.16);
}

.chat-messages {
    display: none;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
}

.chat-layout.has-messages .chat-messages {
    display: grid;
    min-height: 110px;
    max-height: 320px;
    overflow: auto;
    margin-top: 8px;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 18px;
    line-height: 1.5;
}

.chat-bubble.user {
    justify-self: end;
    background: rgba(255, 143, 61, 0.16);
    border: 1px solid rgba(255, 143, 61, 0.24);
}

.chat-bubble.assistant {
    background: rgba(93, 226, 204, 0.1);
    border: 1px solid rgba(93, 226, 204, 0.16);
}

.chat-form {
    display: grid;
    gap: 12px;
}

textarea {
    resize: vertical;
    padding: 14px 16px;
    font: inherit;
    min-height: 84px;
}

.empty-state {
    color: var(--muted);
    min-height: 80px;
    place-items: center;
}

@keyframes drift {
    from { transform: rotate(0deg) translateX(0px); }
    50% { transform: rotate(180deg) translateX(10px); }
    to { transform: rotate(360deg) translateX(0px); }
}

@media (max-width: 1400px) {
    .main-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 1100px) {
    .hero {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "copy"
            "chat";
        gap: 20px;
    }

    .hero h1 {
        max-width: none;
    }

    .hero-copy {
        min-height: auto;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .panel-span-2 {
        grid-column: span 1;
    }

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

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

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

    .history-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-shell {
        padding: 16px 12px 28px;
    }

    .hero,
    .panel {
        border-radius: 18px;
        padding: 14px;
    }

    .hero-actions {
        flex-wrap: wrap;
    }

    .main-grid {
        gap: 14px;
    }

    .panel-header,
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .pick-grid,
    .facts-grid,
    .history-grid {
        grid-template-columns: 1fr;
    }

    .pick-controls {
        grid-template-columns: 1fr;
    }

    .history-controls {
        grid-template-columns: 1fr;
    }

    .sparkline,
    .sparkline svg {
        width: 100%;
    }

    .chat-bubble {
        max-width: 100%;
    }

    textarea {
        min-height: 96px;
    }
}

@media (max-width: 1100px) {
    .hero,
    .main-grid,
    .pick-grid,
    .facts-grid,
    .history-grid {
        grid-template-columns: 1fr;
    }

    .panel-span-2 {
        grid-column: span 1;
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding: 18px 14px 32px;
    }

    .hero,
    .panel {
        padding: 18px;
        border-radius: 20px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-actions,
    .panel-header,
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sportsbook-filter {
        width: 100%;
        min-width: 0;
    }
}
