:root {
    --bg: #0f1420;
    --card: #182031;
    --border: #27314a;
    --text: #e8ecf5;
    --muted: #94a0bb;
    --accent: #4f8cff;
    --danger: #d9534f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

.card {
    width: 100%;
    max-width: 34rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

h1 {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
}

.subtitle {
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.google-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.google-mark {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

/* Profile page */
.identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

.name {
    margin: 0;
    font-size: 1.3rem;
}

.email {
    color: var(--muted);
    font-size: 0.9rem;
}

.facts {
    display: grid;
    gap: 0.9rem;
}

.fact {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.value {
    font-size: 1.05rem;
    font-weight: 600;
}

.value.muted {
    font-weight: 400;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.logout-form {
    margin: 0;
}

.ui-button-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    font: inherit;
}

/* Kelly calculator */

/* The calculator is taller than the viewport, and a centred flex child gets its overflow
   clipped at the top rather than scrolled to. */
body.tools {
    align-items: flex-start;
}

.card.wide {
    max-width: 68rem;
}

.calc-panel {
    margin-bottom: 1.25rem;
}

.hint {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.875rem;
}

/* One row per market / true price / leg: its inputs on the left, its results on the right. */
.calc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.total-row {
    background: rgba(79, 140, 255, 0.06);
    border-color: var(--accent);
}

.row-tag {
    flex: 0 0 auto;
    min-width: 5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.row-inputs {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
}

/* A labelled field: caption stacked over the input. */
.input-cell {
    display: inline-flex;
    flex-direction: column;
    gap: 0.2rem;
}

/*
 * A vig side: the field and its remove button sit side by side. This is a ROW, not a column -
 * stacking them is what pushed the button under the field and grew the row's height.
 */
.side-cell {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.2rem;
    flex: 0 0 auto;
}

.cell-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.odds-input {
    width: 6.5rem;
}

/* Results sit at the far end of the row, pushed there rather than positioned. */
.row-out {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.out-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.9rem;
    max-width: 100%;
    overflow-x: auto;
}

.out {
    display: inline-flex;
    flex-direction: column;
}

.label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    white-space: nowrap;
}

/*
 * Three tiers, used identically in every section: accent for the row's headline figure, plain for
 * a supporting one, small for a secondary detail.
 */
.value {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.value.small {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.value.accent {
    font-size: 1.1rem;
    color: var(--accent);
}

/* The stake section's running total, lined up under the rows' results. */
.stake-summary .out-group {
    justify-content: flex-end;
    padding: 0.2rem 0.85rem 0.6rem;
}

.row-error {
    color: var(--danger);
    font-size: 0.85rem;
}

.row-note {
    color: var(--muted);
    font-size: 0.8rem;
}

/* Compact buttons, so a row of sides does not turn into a row of chrome. */
.small-button.ui-button {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
    flex: 0 0 auto;
}

/*
 * Square and small enough to sit beside a field without setting the row's height: the line-height
 * is pinned so the icon cannot push the button taller than the input next to it.
 */
.icon-only.ui-button {
    padding: 0;
    width: 1.6rem;
    height: 1.6rem;
    min-width: 1.6rem;
    line-height: 1.6rem;
    font-size: 0.7rem;
    flex: 0 0 auto;
}

.icon-only .ui-button-text {
    display: none;
}

.icon-only .ui-icon,
.icon-only .ui-button-icon-left {
    position: static;
    margin: 0;
}

.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.page-nav {
    margin-top: 0.5rem;
}

.page-nav a,
.profile-nav a {
    color: var(--accent);
    font-size: 0.9rem;
}

@media (max-width: 720px) {
    .card {
        padding: 1.25rem;
    }

    .identity {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Below this width a row cannot hold inputs and results side by side, so the results
       drop underneath rather than squeezing the fields. */
    .row-out {
        margin-left: 0;
        width: 100%;
    }

    .odds-input {
        width: 6rem;
    }
}
