/* Overcut -- Dark theme CSS
   Ported from inspo/overcut.jsx prototype */

/* ---- Custom Properties ---- */
:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface2: #1c1c1c;
    --border: #2a2a2a;
    --border2: #333;
    --red: #e10600;
    --red-dark: #b00500;
    --white: #f0f0f0;
    --gray: #888;
    --dim-gray: #555;
    --over: #22c55e;
    --over-dim: #166534;
    --under: #3b82f6;
    --under-dim: #1e3a5f;
    --yes: #22c55e;
    --yes-dim: #166534;
    --no: #ef4444;
    --no-dim: #7f1d1d;
}

/* ---- Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Base ---- */
html {
    font-size: 14px;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--white);
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Header ---- */
header {
    background: var(--surface);
    border-bottom: 2px solid var(--red);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.logo-icon {
    color: var(--red);
    font-size: 20px;
}

.logo-text {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--white);
    text-transform: uppercase;
}

.logo-tag {
    font-size: 11px;
    color: var(--gray);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ---- Content Container ---- */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ---- Section Title ---- */
.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gray);
}

/* ---- Section Cards ---- */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.section-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-body {
    padding: 16px 18px;
}

/* ---- Inputs ---- */
input,
select,
textarea {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--white);
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--red);
}

input::placeholder {
    color: var(--dim-gray);
}

/* ---- Buttons ---- */
.btn {
    background: var(--red);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--red-dark);
}

.btn-small {
    background: transparent;
    color: var(--gray);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-small:hover {
    color: var(--white);
    border-color: var(--white);
}

.btn-ghost {
    background: transparent;
    color: var(--red);
    border: none;
    padding: 4px 8px;
    font-size: 16px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-ghost:hover {
    color: var(--white);
}

/* ---- Form Layout Helpers ---- */
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-row > * {
    flex: 1;
    min-width: 0;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---- Home Page Cards ---- */
.home-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-actions {
    padding: 16px 18px;
    display: flex;
    justify-content: flex-end;
}

/* ---- Code Input ---- */
.code-input {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 6px;
    text-align: center;
    text-transform: uppercase;
    padding: 12px;
}

/* ---- Utility ---- */
.text-gray {
    color: var(--gray);
}

.text-dim {
    color: var(--dim-gray);
}

.text-red {
    color: var(--red);
}

.text-center {
    text-align: center;
}

.mt-12 {
    margin-top: 12px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ---- Links ---- */
a {
    color: var(--red);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---- Lobby Page ---- */
.lobby {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-code {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 12px;
    text-align: center;
    color: var(--white);
    padding: 16px 0 8px;
}

.join-link {
    text-align: center;
    padding-bottom: 8px;
}

.join-link a {
    font-size: 12px;
    color: var(--gray);
    letter-spacing: 1px;
}

.race-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 0 4px;
}

.race-name {
    font-size: 18px;
    font-weight: 700;
}

.race-date {
    font-size: 12px;
}

/* ---- State Badge ---- */
.state-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 4px;
}

/* ---- Player List ---- */
.player-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.player-chip + .player-chip {
    border-top: 1px solid var(--border);
}

.player-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-name {
    font-size: 14px;
    font-weight: 600;
}

.host-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--gray);
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* ---- Prop Cards ---- */
.prop-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.prop-card-readonly {
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.prop-card-readonly + .prop-card-readonly {
    border-top: 1px solid var(--border);
}

.prop-card {
    padding: 12px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.prop-card + .prop-card {
    border-top: 1px solid var(--border);
}

.prop-card.prop-not-scored {
    opacity: 0.5;
}

.prop-not-scored-badge {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    color: var(--no);
    background: var(--no-dim);
}

.prop-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.prop-reorder .btn-ghost {
    font-size: 10px;
    padding: 2px 6px;
    min-height: 28px;
}

/* ---- Prop Edit Mode ---- */
.prop-card form {
    width: 100%;
}

.prop-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prop-edit-text {
    font-size: 13px;
    font-weight: 600;
}

.prop-edit-row {
    display: flex;
    gap: 8px;
}

.prop-edit-line {
    flex: 1;
}

.prop-edit-type {
    width: 80px;
    flex-shrink: 0;
}

.prop-scored-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gray);
    cursor: pointer;
}

.prop-scored-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--red);
}

.prop-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-danger {
    color: var(--no) !important;
    border-color: var(--no) !important;
}

.btn-danger:hover {
    background: var(--no-dim) !important;
}

/* ---- Add Prop Card ---- */
.prop-add-card {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.btn-add-prop {
    width: 100%;
    text-align: center;
    border-style: dashed;
}

.prop-text {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
}

.prop-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.prop-line {
    font-size: 12px;
    color: var(--gray);
}

.prop-type-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.type-ou {
    color: var(--over);
    background: var(--over-dim);
}

.type-yn {
    color: var(--yes);
    background: var(--yes-dim);
}

/* ---- Host Controls ---- */
.host-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---- Join Page ---- */
.join-page {
    max-width: 400px;
    margin: 0 auto;
}

.game-code-small {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--white);
}

.join-race-info {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
}

.welcome-back {
    font-size: 14px;
    color: var(--over);
    font-weight: 600;
}

.form-error {
    font-size: 13px;
    color: var(--no);
    font-weight: 600;
}

.btn-full {
    width: 100%;
}

/* ---- Pick Buttons ---- */
.pick-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.pick-btn {
    flex: 1;
    padding: 10px 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card, var(--surface));
    color: var(--dim-gray);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pick-selected-over, .pick-selected-yes {
    background: var(--over);
    color: var(--bg);
    border-color: var(--over);
}

.pick-selected-under {
    background: var(--under);
    color: var(--bg);
    border-color: var(--under);
}

.pick-selected-no {
    background: var(--no);
    color: var(--bg);
    border-color: var(--no);
}

/* ---- Numeric Pick/Result Input ---- */
.numeric-pick-input, .numeric-result-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--white);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
}
.numeric-pick-input:focus, .numeric-result-input:focus {
    outline: none;
    border-color: var(--over);
}
.type-numeric {
    background: #3a2a6e40;
    color: #b39ddb;
    border-color: #b39ddb;
}
.pick-distance {
    color: var(--dim-gray);
    font-size: 11px;
    font-weight: 400;
}

/* Picks not open label */
.picks-not-open {
    color: var(--dim-gray);
    font-size: 12px;
    font-style: italic;
    margin-top: 6px;
}

/* ---- Tiebreaker Section ---- */
.tiebreaker-card {
    padding: 12px;
}

.tiebreaker-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.tiebreaker-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--white);
    font-family: inherit;
    font-size: 14px;
}

/* ---- Pick Counter ---- */
#pick-counter {
    font-size: 12px;
    color: var(--dim-gray);
}

/* ---- Pick Reveal Card (locked state) ---- */
.pick-reveal-card {
    background: var(--card, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}
.pick-reveal-card .prop-text { font-weight: 600; margin-bottom: 4px; }
.pick-reveal-card .prop-meta { margin-bottom: 8px; }
.pick-reveal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-top: 1px solid var(--border);
}
.pick-reveal-row:first-of-type { border-top: none; }
.pick-reveal-name { font-weight: 500; }
.pick-reveal-choice {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}
.pick-reveal-none { color: var(--dim-gray); font-style: italic; font-size: 12px; }

/* ---- Tiebreaker Reveal ---- */
.tiebreaker-reveal-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-top: 1px solid var(--border);
}
.tiebreaker-reveal-row:first-child { border-top: none; }

/* ---- Lock My Picks Button ---- */
.btn-lock {
    background: var(--over);
    color: var(--bg);
    font-weight: 700;
    padding: 14px 32px;
    font-size: 16px;
}

/* ---- Prop Card with Pick Buttons ---- */
.prop-card-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* ---- Score Card (scoring state) ---- */
.score-card {
    background: var(--card, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}
.score-card .prop-text { font-weight: 600; margin-bottom: 4px; }
.score-card .prop-meta { margin-bottom: 8px; }

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-top: 1px solid var(--border);
}

.score-player-name { font-weight: 500; }

.score-pick {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}

.pick-correct { color: var(--over); }
.pick-wrong { color: var(--no); opacity: 0.6; }
.pick-mark { margin-left: 4px; }
.pick-none { color: var(--dim-gray); font-style: italic; font-size: 12px; }

/* ---- Result Badge ---- */
.result-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}
.result-over, .result-yes {
    color: var(--over);
    background: var(--over-dim);
}
.result-under {
    color: var(--under);
    background: var(--under-dim);
}
.result-no {
    color: var(--no);
    background: var(--no-dim);
}

/* ---- Result Buttons ---- */
.result-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
    width: 100%;
}

/* ---- Winner Cards ---- */
.winner-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.winner-card {
    flex: 1;
    min-width: 100px;
    text-align: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 8px;
}
.winner-highlight {
    background: var(--red);
    border-color: var(--red);
    color: var(--white);
}
.winner-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
    color: var(--white);
}
.winner-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}
.winner-score {
    font-size: 24px;
    font-weight: 800;
}
.winner-total {
    font-size: 11px;
}
.winner-empty {
    width: 100%;
    padding: 16px;
}
.tiebreaker-note {
    width: 100%;
    text-align: center;
    font-size: 12px;
    margin-top: 4px;
}

/* ---- Score It Button ---- */
.score-it-btn {
    background: var(--surface2);
    color: var(--white);
    border: 1px solid var(--border2);
}
.score-it-btn:hover {
    background: var(--border2);
}

/* ---- Tiebreaker Result Section ---- */
.tiebreaker-result-section {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.tiebreaker-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.tiebreaker-position-input {
    width: 80px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--white);
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    text-align: center;
}
.tiebreaker-position-input:focus {
    outline: none;
    border-color: var(--over);
}
.tiebreaker-clear-btn {
    background: var(--surface2);
    color: var(--dim-gray);
    border: 1px solid var(--border);
}
.tiebreaker-subtitle {
    font-size: 12px;
    margin-bottom: 8px;
}

/* ---- QR Code Container ---- */
.qr-container {
    margin: 16px auto 0;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    display: block;
    max-width: 250px;
}

.qr-container svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 480px) {
    .prop-card {
        flex-direction: column;
        align-items: stretch;
    }

    .prop-card-inner {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 4px 8px;
    }

    .prop-card-inner .prop-context {
        grid-column: 1 / -1;
    }

    .prop-card-readonly {
        flex-direction: column;
        align-items: flex-start;
    }

    .prop-reorder {
        flex-direction: row;
        align-self: flex-end;
    }
}
