/* simulation.css — Pricing Simulation Game Styles */

/* ========= BODY ========= */
.sim-body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ========= SCREEN SYSTEM ========= */
.sim-screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    flex-direction: column;
}

.sim-screen.active {
    display: flex;
    animation: simFadeIn 0.3s ease;
}

@keyframes simFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========= SHARED NAV LINK ========= */
.sim-back-link {
    font-family: var(--font-family-mono);
    font-size: 0.82rem;
    color: var(--color-charcoal);
    text-decoration: none;
    opacity: 0.65;
    transition: opacity 0.2s;
}

.sim-back-link:hover {
    opacity: 1;
}

/* ========= SCREEN 1: SPLASH ========= */
#screen-1 {
    background-color: var(--bg-color-beige);
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
}

#screen-1 .sim-back-link {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
}

.sim-splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 680px;
    padding: 2rem;
}

.sim-wordmark {
    font-family: 'Poppins', sans-serif;
    font-size: 5rem;
    font-weight: 400;
    color: var(--color-charcoal);
    line-height: 1;
    letter-spacing: -0.02em;
}

.sim-splash-title {
    font-family: 'Arial Black', sans-serif;
    font-size: 2.2rem;
    color: var(--color-grey-dark);
    margin: 0;
    letter-spacing: -0.03em;
}

.sim-question-preview {
    font-family: var(--font-family-mono);
    font-size: 0.82rem;
    color: var(--color-grey-medium);
    background: rgba(45, 45, 45, 0.04);
    border: 0.5px solid var(--color-charcoal);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    max-width: 520px;
    line-height: 1.6;
    text-align: left;
}

.sim-splash-sub {
    font-size: 0.82rem;
    color: var(--color-grey-medium);
    font-family: var(--font-family-mono);
    margin: 0;
}

/* ========= SCREEN 2: DEMOGRAPHICS ========= */
#screen-2 {
    background-color: var(--bg-color-beige);
    align-items: center;
    justify-content: flex-start;
    padding: 3rem 1rem 4rem;
    position: relative;
}

.sim-card {
    background: #fff;
    border: 0.5px solid var(--color-charcoal);
    border-radius: 4px;
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    position: relative;
}

.sim-card .sim-back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
}

.sim-card hgroup {
    margin-bottom: 2rem;
}

.sim-card hgroup h2 {
    margin-bottom: 0.25rem;
}

.sim-card hgroup p {
    color: var(--color-grey-medium);
    font-size: 0.9rem;
}

/* Fieldsets */
.sim-card fieldset {
    border: 0.5px solid var(--bg-color-grey-05);
    border-radius: 4px;
    padding: 1rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
}

.sim-card legend {
    font-family: var(--font-family-sans);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0 0.4rem;
    color: var(--color-charcoal);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.radio-label:hover {
    background: rgba(63, 122, 42, 0.06);
}

.radio-label input[type="radio"] {
    accent-color: var(--color-variable-green);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
}

/* WTP Slider in Screen 2 */
.s2-slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.s2-slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--color-variable-green);
    cursor: pointer;
}

.s2-slider-bound {
    font-family: var(--font-family-mono);
    font-size: 0.78rem;
    color: var(--color-grey-medium);
    min-width: 2.5rem;
}

.s2-slider-value {
    margin-top: 0.5rem;
    font-family: var(--font-family-mono);
    font-size: 0.9rem;
    color: var(--color-charcoal);
}

/* ========= SCREEN 3: GAME HEADER ========= */
.sim-game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.25rem;
    background: var(--bg-color-beige);
    border-bottom: 0.5px solid var(--color-charcoal);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.sim-game-title {
    font-family: var(--font-family-mono);
    font-size: 0.78rem;
    color: var(--color-grey-medium);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ========= SCREEN 3: 4-PANEL GAME GRID ========= */
#screen-3 {
    background-color: var(--bg-color-beige);
    flex-direction: column;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    flex: 1;
    min-height: calc(100vh - 44px);
}

.game-panel {
    border-right: 0.5px solid var(--color-charcoal);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
    position: relative;
}

.game-panel:last-child {
    border-right: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid var(--color-charcoal);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.panel-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-grey-medium);
    font-family: var(--font-family-mono);
}

/* ---- Panel 1: Customer ---- */
.customer-counter {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem 0.5rem;
    border-bottom: 0.5px solid var(--color-charcoal);
    flex-shrink: 0;
}

.customer-counter .mono {
    font-size: 0.82rem;
    min-width: 5rem;
    text-align: center;
}

.counter-btn {
    width: 1.6rem !important;
    height: 1.6rem !important;
    padding: 0 !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    border-radius: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: unset !important;
}

.stick-figure-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

#stick-figure {
    width: 96px;
    height: 192px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ---- Customer info card (beneath stick figure) ---- */
.customer-info-card {
    width: 100%;
    max-width: 180px;
    border: 0.5px solid var(--color-charcoal);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.ci-row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.35rem 0.6rem;
    border-bottom: 0.5px solid var(--bg-color-grey-05);
}

.ci-row:last-child {
    border-bottom: none;
}

.ci-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-grey-medium);
    font-family: var(--font-family-sans);
    line-height: 1;
}

.ci-value {
    font-size: 0.78rem;
    color: var(--color-charcoal);
    font-weight: 500;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
}

/* ---- Speech Bubble ---- */
.speech-bubble {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    font-family: var(--font-family-mono);
    font-size: 0.92rem;
    font-weight: 700;
    border: 2px solid var(--color-charcoal);
    background: #fff;
    border-radius: 4px;
    padding: 0.4rem 0.9rem;
    text-align: center;
    position: relative;
    min-width: 90px;
    min-height: 2.2rem;
}

.speech-bubble.bubble-visible {
    opacity: 1;
    visibility: visible;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid var(--color-charcoal);
}

.speech-bubble.bubble-deal {
    color: var(--color-variable-green);
    border-color: var(--color-variable-green);
}

.speech-bubble.bubble-deal::after {
    border-top-color: var(--color-variable-green);
}

.speech-bubble.bubble-nodeal {
    color: #cc2222;
    border-color: #cc2222;
}

.speech-bubble.bubble-nodeal::after {
    border-top-color: #cc2222;
}

/* ---- Panel 2: Offer ---- */
.offer-question-box {
    font-size: 0.77rem;
    color: var(--color-charcoal);
    background: rgba(45, 45, 45, 0.04);
    border: 0.5px solid var(--bg-color-grey-05);
    border-radius: 4px;
    padding: 0.65rem 0.75rem;
    font-family: var(--font-family-mono);
    line-height: 1.5;
    flex-shrink: 0;
    margin-bottom: 0.75rem;
}

.price-slider-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.slider-track-container {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    justify-content: center;
    width: 100%;
}

.price-labels-vert {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: var(--font-family-mono);
    font-size: 0.7rem;
    color: var(--color-grey-medium);
    padding: 4px 0;
    min-width: 2rem;
    text-align: right;
}

.vertical-slider-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

input[type='range'].vertical-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 28px;
    height: 180px;
    accent-color: var(--color-variable-green);
    cursor: pointer;
    appearance: slider-vertical;
    -webkit-appearance: slider-vertical;
}


.offer-price-display {
    font-family: var(--font-family-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-variable-green);
    text-align: center;
    flex-shrink: 0;
}

/* ---- Panel 3: History ---- */
.sort-btn {
    font-size: 0.68rem !important;
    padding: 0.2rem 0.5rem !important;
    min-width: unset !important;
    height: auto !important;
    border-radius: 2px !important;
    margin: 0.35rem 0.75rem 0.3rem;
    display: inline-block;
}

.chart-wrap {
    flex-shrink: 0;
    height: 160px;
    position: relative;
    margin-bottom: 0.5rem;
}

.chart-wrap canvas {
    max-height: 160px;
}

.table-scroll {
    overflow-y: auto;
    flex: 1;
}

.table-scroll table {
    width: 100%;
    font-size: 0.73rem;
    border-collapse: collapse;
}

.table-scroll th {
    font-family: var(--font-family-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.4rem;
    border-bottom: 0.5px solid var(--color-charcoal);
    position: sticky;
    top: 0;
    background: var(--bg-color-beige);
    white-space: nowrap;
}

.table-scroll td {
    padding: 0.3rem 0.4rem;
    border-bottom: 0.5px solid var(--bg-color-grey-05);
    white-space: nowrap;
}

/* ---- Panel 4: Revenue ---- */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 0.5px solid var(--bg-color-grey-05);
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--color-grey-medium);
    font-family: var(--font-family-sans);
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-charcoal);
    font-family: var(--font-family-mono);
}

/* ---- Shared result colouring ---- */
.deal       { color: var(--color-variable-green); font-weight: 700; }
.no-deal    { color: #cc2222; font-weight: 700; }
.val-revenue { color: var(--color-variable-green); }
.val-regret  { color: #cc2222; }

/* ========= TOAST ========= */
.sim-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-charcoal);
    color: #fff;
    font-family: var(--font-family-mono);
    font-size: 0.82rem;
    padding: 0.55rem 1.2rem;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 999;
    white-space: nowrap;
}

.sim-toast.visible {
    opacity: 1;
}

/* ========= SCREEN: GAME OVER ========= */
#screen-game-over {
    background: var(--bg-color-beige);
    align-items: center;
    flex-direction: column;
    padding: 2.5rem 1rem 5rem;
    gap: 1.75rem;
}

/* The card captured by html2canvas */
.game-over-card {
    background: #fff;
    border: 0.5px solid var(--color-charcoal);
    border-radius: 4px;
    padding: 2rem 2.25rem;
    max-width: 960px;
    width: 100%;
}

.game-over-header {
    border-bottom: 0.5px solid var(--bg-color-grey-05);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.game-over-header h2 {
    font-family: 'Arial Black', sans-serif;
    margin: 0 0 0.5rem;
    letter-spacing: -0.03em;
}

.go-question-text {
    font-family: var(--font-family-mono);
    font-size: 0.78rem;
    color: var(--color-grey-medium);
    line-height: 1.5;
    margin: 0;
}

.go-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.go-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border: 0.5px solid var(--bg-color-grey-05);
    border-radius: 4px;
    padding: 0.65rem 0.85rem;
}

/* Capture Rate spans the full width of the grid for prominence */
.go-stat-capture {
    grid-column: 1 / -1;
    background: rgba(63, 122, 42, 0.04);
    border-color: var(--color-variable-green);
}

.go-stat-capture .go-stat-value {
    font-size: 1.5rem;
    color: var(--color-variable-green);
}

.go-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-grey-medium);
    font-family: var(--font-family-sans);
}

.go-stat-value {
    font-family: var(--font-family-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-charcoal);
}

.go-charts-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.go-chart-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    overflow: hidden;
}

.go-chart-label {
    font-family: var(--font-family-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-grey-medium);
    margin: 0;
}

.go-chart-wrap canvas {
    max-height: 160px;
}

.game-over-footer {
    font-family: var(--font-family-mono);
    font-size: 0.75rem;
    color: var(--color-grey-medium);
    text-align: center;
    border-top: 0.5px solid var(--bg-color-grey-05);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

/* Action buttons row */
.go-action-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 960px;
    width: 100%;
}

/* Override brand green for outline action buttons */
.go-action-row a[role='button'] {
    background-color: transparent !important;
    color: var(--color-charcoal) !important;
    border: 1px solid var(--color-charcoal) !important;
    font-weight: 500 !important;
}

.go-action-row a[role='button']:hover {
    background-color: var(--color-charcoal) !important;
    color: #fff !important;
}

/* Full results table section */
.go-results-wrap {
    max-width: 960px;
    width: 100%;
}

.go-results-label {
    font-family: var(--font-family-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-grey-medium);
    margin-bottom: 0.6rem;
}

/* ========= FATAL ERROR ========= */
.fatal-error {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: var(--bg-color-beige);
    text-align: center;
    padding: 2rem;
}

/* ========= RESPONSIVE ========= */
@media (max-width: 1100px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        min-height: auto;
    }

    .game-panel {
        border-bottom: 0.5px solid var(--color-charcoal);
        min-height: 320px;
    }

    .game-panel:nth-child(even) {
        border-right: none;
    }
}

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

    .game-panel {
        border-right: none;
        min-height: 280px;
    }

    .go-stats-grid,
    .go-charts-row {
        grid-template-columns: 1fr;
    }

    .sim-wordmark {
        font-size: 3.5rem;
    }

    .go-action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .game-over-card {
        padding: 1.25rem;
    }
}
