:root {
    color-scheme: light;
    --bg: #eef3f0;
    --panel: #ffffff;
    --ink: #102116;
    --muted: #607064;
    --line: #d9e5dd;
    --green: #1f6b3a;
    --green-dark: #12351f;
    --clay: #c7643a;
    --hard: #2f6fa3;
    --grass: #4f8a39;
    --warning: #86621a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.app-shell {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--green-dark);
    color: white;
    font-weight: 800;
    letter-spacing: .04em;
}

.brand-copy h1,
.brand-copy p,
.chat-panel-copy h2,
.chat-panel-copy p {
    margin: 0;
}

.brand-copy h1 {
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1;
}

.brand-copy p,
.chat-panel-copy p,
.screen-body,
.disclaimer-card p {
    color: var(--muted);
    line-height: 1.6;
}

.brand-kicker,
.section-kicker,
.chat-empty-kicker {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.live-pill,
.chat-surface-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 700;
}

.live-dot,
.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--grass);
}

.tennis-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
    gap: 18px;
    align-items: start;
}

.chat-card,
.panel-card,
.insight-panel,
.message-bubble {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.chat-card {
    min-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-panel-heading,
.composer-panel,
.panel-card {
    padding: 18px;
}

.chat-panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
}

.chat-surface {
    position: relative;
    flex: 1;
    min-height: 520px;
    background: #f8fbf9;
}

.chat-container {
    height: 100%;
    max-height: calc(100vh - 330px);
    overflow-y: auto;
    padding: 18px;
}

.chat-empty {
    position: absolute;
    inset: 18px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
    padding: 30px;
    border: 1px dashed #bfd1c5;
    border-radius: 8px;
    color: var(--muted);
}

.chat-empty h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 24px;
}

.message {
    margin-bottom: 16px;
}

.message.user {
    display: grid;
    justify-items: end;
}

.message-meta {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

.message-bubble {
    max-width: min(760px, 92%);
    padding: 14px 16px;
    line-height: 1.58;
}

.message.user .message-bubble {
    background: var(--green-dark);
    color: white;
    border-color: var(--green-dark);
}

.message-bubble p {
    margin: 0 0 10px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.composer-panel {
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.chat-activity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
}

.input-container {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
}

input,
select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
}

button {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--green-dark);
    border-radius: 8px;
    background: var(--green-dark);
    color: white;
    font-weight: 800;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

#clearBtn,
.screen-reset-btn,
.quick-action {
    background: white;
    color: var(--green-dark);
    border-color: var(--line);
}

.side-panel {
    display: grid;
    gap: 14px;
}

.stage-screen {
    position: relative;
    min-height: 330px;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(18, 53, 31, .92), rgba(31, 107, 58, .78)),
        repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, transparent 1px 42px);
}

.featured-placeholder {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 22% 20%, rgba(255,255,255,.20), transparent 18%),
        linear-gradient(120deg, rgba(199,100,58,.32), transparent 48%),
        linear-gradient(35deg, rgba(47,111,163,.26), transparent 52%);
}

.featured-image-link,
.featured-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.featured-image {
    object-fit: cover;
}

.screen-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: end;
    padding: 18px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.64) 100%);
}

.screen-copy {
    color: white;
    width: 100%;
}

.screen-copy-head,
.screen-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.screen-eyebrow {
    color: #d7f2de;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.screen-copy-title {
    display: block;
    margin: 12px 0 8px;
    font-size: 24px;
    line-height: 1.15;
}

.screen-body {
    color: #edf7ef;
}

.screen-action-link {
    color: white;
    font-weight: 800;
}

.channel-nav {
    position: absolute;
    z-index: 3;
    top: 50%;
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-color: rgba(255,255,255,.3);
    background: rgba(0,0,0,.35);
}

.channel-nav-left {
    left: 10px;
}

.channel-nav-right {
    right: 10px;
}

.prediction-form {
    display: grid;
    gap: 10px;
}

.prediction-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.prediction-result {
    margin-top: 12px;
}

.prediction-mini,
.prediction-panel {
    padding: 14px;
}

.prediction-mini h3,
.prediction-panel h3,
.insight-panel h3 {
    margin: 0 0 6px;
}

.probability-row {
    margin: 12px 0;
}

.probability-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

.probability-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ede8;
}

.probability-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--clay), var(--hard), var(--grass));
}

.risk-note {
    color: var(--warning);
    font-size: 13px;
    line-height: 1.5;
}

.quick-actions {
    display: grid;
    gap: 8px;
}

.insight-panel {
    margin: 14px 0;
    padding: 16px;
}

.news-card {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.news-card h4,
.news-card p {
    margin: 4px 0;
}

.news-card-meta {
    color: var(--muted);
    font-size: 12px;
}

.screen-loading-rail {
    display: flex;
    gap: 6px;
    margin: 10px 0;
}

.screen-loading-rail span {
    width: 26px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,.65);
    animation: pulse 1s ease-in-out infinite alternate;
}

.screen-loading-rail span:nth-child(2) {
    animation-delay: .12s;
}

.screen-loading-rail span:nth-child(3) {
    animation-delay: .24s;
}

@keyframes pulse {
    from { opacity: .3; transform: scaleX(.55); }
    to { opacity: 1; transform: scaleX(1); }
}

@media (max-width: 980px) {
    .app-header,
    .chat-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .tennis-layout {
        grid-template-columns: 1fr;
    }

    .chat-card {
        min-height: auto;
    }

    .chat-container {
        max-height: none;
        min-height: 460px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 20px, 1480px);
        padding: 14px 0;
    }

    .brand {
        align-items: flex-start;
    }

    .input-container,
    .form-row {
        grid-template-columns: 1fr;
    }

    .screen-copy-title {
        font-size: 20px;
    }
}
