/**
 * Hand Scorer styles v1.3
 * Scoped to .hand-scorer to avoid theme conflicts.
 */
.hand-scorer {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    font-size: 15px;
    line-height: 1.5;
    color: #222;
}

.hand-scorer * {
    box-sizing: border-box;
}

/* ===== Start screen ===== */
.hand-scorer .hs-start {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
}

.hand-scorer .hs-start-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #222;
}

.hand-scorer .hs-start-hint {
    font-size: 13px;
    color: #666;
    margin: 0 0 20px;
}

.hand-scorer .hs-start-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.hand-scorer .hs-start-row {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.hand-scorer .hs-start-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.hand-scorer .hs-start-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    min-width: 0;
}

.hand-scorer .hs-start-input:focus {
    outline: none;
    border-color: #2b6cb0;
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.2);
}

.hand-scorer .hs-suggest-label {
    font-size: 12px;
    color: #666;
    margin: 8px 0 8px;
}

.hand-scorer .hs-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 0 auto 20px;
    max-width: 320px;
}

.hand-scorer .hs-suggest-chip {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #d0d0d0;
    background: #f7f7f5;
    color: #333;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.hand-scorer .hs-suggest-chip:hover,
.hand-scorer .hs-suggest-chip:active {
    background: #2b6cb0;
    color: #fff;
    border-color: #2b6cb0;
}

.hand-scorer .hs-start-btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    background: #2b6cb0;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.hand-scorer .hs-start-btn:hover {
    background: #2c5282;
}

/* ===== Menu bar ===== */
.hand-scorer .hs-menu {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hand-scorer .hs-menu button {
    flex: 1;
    min-width: 72px;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    background: #fff;
    color: #222;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.hand-scorer .hs-menu button:hover {
    background: #f5f5f5;
    border-color: #999;
}

.hand-scorer .hs-menu button.hs-btn-add {
    background: #2b6cb0;
    color: #fff;
    border-color: #2b6cb0;
}

.hand-scorer .hs-menu button.hs-btn-add:hover {
    background: #2c5282;
    border-color: #2c5282;
}

/* ===== Status banner (winner) ===== */
.hand-scorer .hs-status-banner {
    display: none;
    padding: 12px;
    background: #d4edda;
    color: #155724;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
}

/* ===== Board: full width, no horizontal scroll ===== */
.hand-scorer .hs-board-wrap {
    width: 100%;
    margin-bottom: 16px;
}

.hand-scorer .hs-board {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.hand-scorer .hs-board th,
.hand-scorer .hs-board td {
    padding: 9px 4px;
    text-align: center;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hand-scorer .hs-board thead th {
    font-weight: 700;
    color: #222;
    font-size: 15px;
    border-bottom: 2px solid #d0d0d0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.hand-scorer .hs-board thead th.hs-col-rnd {
    color: #999;
    font-weight: 500;
}

.hand-scorer .hs-col-rnd {
    width: 26px;
    color: #999;
    font-weight: 500;
}

.hand-scorer .hs-board tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.hand-scorer .hs-board tbody tr:hover {
    background: #fafafa;
}

.hand-scorer .hs-empty {
    padding: 24px !important;
    color: #999;
    text-align: center !important;
    font-style: italic;
    white-space: normal !important;
}

/* ===== Cell highlights ===== */
/* Default burn text color (current-round burn) */
.hand-scorer .hs-burn {
    color: #c0392b;
    font-weight: 600;
}

/* Player already burned on previous rounds: red text */
.hand-scorer .hs-burned-player {
    color: #c0392b;
    font-weight: 600;
}

/* Hand winner (-40): amber, only the player's own cell */
.hand-scorer .hs-hand-winner {
    background: #ffc107 !important;
    color: #000;
    font-weight: 600;
}

/* Regular winner (-20): light blue */
.hand-scorer .hs-reg-winner {
    background: #bee3f8 !important;
    color: #1a365d;
    font-weight: 600;
}

/* Score was recovered from over-200 (rolled back to max valid opponent score) */
.hand-scorer .hs-recovered {
    background: #fbeef0 !important;
    color: #222;
}

/* ===== Footer ===== */
.hand-scorer .hs-board tfoot td {
    border-top: 2px solid #d0d0d0;
    border-bottom: none;
    font-weight: 500;
}

.hand-scorer .hs-footer-totals td {
    background: #f7f7f5;
    font-weight: 600;
}

.hand-scorer .hs-footer-pay td {
    color: #555;
    font-size: 12px;
}

/* ===== Modal ===== */
.hand-scorer .hs-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.hand-scorer .hs-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hand-scorer .hs-modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.hand-scorer .hs-modal-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 14px;
}

.hand-scorer .hs-modal-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

/* Per-player row: [name] [quick buttons] [input] */
.hand-scorer .hs-modal-row {
    display: grid;
    grid-template-columns: 60px 1fr 56px;
    align-items: center;
    gap: 6px;
}

.hand-scorer .hs-modal-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hand-scorer .hs-row-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}

.hand-scorer .hs-row-qb {
    padding: 6px 2px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #d0d0d0;
    background: #f7f7f5;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    min-width: 0;
}

.hand-scorer .hs-row-qb:hover,
.hand-scorer .hs-row-qb:active {
    background: #2b6cb0;
    color: #fff;
    border-color: #2b6cb0;
}

.hand-scorer .hs-modal-row input[type=number] {
    padding: 8px 6px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    text-align: right;
    font-family: inherit;
    width: 100%;
    -moz-appearance: textfield;
}

.hand-scorer .hs-modal-row input[type=number]::-webkit-outer-spin-button,
.hand-scorer .hs-modal-row input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hand-scorer .hs-modal-row input[type=number]:focus {
    outline: none;
    border-color: #2b6cb0;
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.2);
}

.hand-scorer .hs-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.hand-scorer .hs-modal-actions button {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #d0d0d0;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.hand-scorer .hs-modal-save {
    background: #2b6cb0 !important;
    color: #fff !important;
    border-color: #2b6cb0 !important;
}

.hand-scorer .hs-modal-save:hover {
    background: #2c5282 !important;
    border-color: #2c5282 !important;
}

.hand-scorer .hs-modal-delete {
    background: #fff !important;
    color: #c0392b !important;
    border-color: #c0392b !important;
}

.hand-scorer .hs-modal-delete:hover {
    background: #fdf2f2 !important;
}

.hand-scorer .hs-modal-cancel:hover {
    background: #f5f5f5;
}

/* ===== Mobile tweaks ===== */
@media (max-width: 768px) {
    .hand-scorer {
        /* Break out of narrow theme containers on mobile */
        margin-left: calc(50% - 50vw + 8px);
        margin-right: calc(50% - 50vw + 8px);
        max-width: none;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .hand-scorer .hs-board {
        font-size: 14px;
    }
    .hand-scorer .hs-board th,
    .hand-scorer .hs-board td {
        padding: 10px 3px;
    }
    .hand-scorer .hs-board thead th {
        font-size: 15px;
    }
    .hand-scorer .hs-col-rnd {
        width: 26px;
    }
    .hand-scorer .hs-menu button {
        padding: 10px 8px;
        font-size: 14px;
    }
    .hand-scorer .hs-modal {
        padding: 4px;
    }
    .hand-scorer .hs-modal-content {
        padding: 14px 12px;
        max-width: 100%;
        max-height: 96vh;
        border-radius: 10px;
    }
    .hand-scorer .hs-modal-row {
        grid-template-columns: 60px 1fr 60px;
        gap: 5px;
    }
    .hand-scorer .hs-modal-name {
        font-size: 13px;
    }
    .hand-scorer .hs-row-qb {
        font-size: 12px;
        padding: 8px 2px;
    }
    .hand-scorer .hs-modal-row input[type=number] {
        font-size: 15px;
        padding: 9px 4px;
    }
}
