body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    user-select: none;
}
.container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}
.hidden {
    display: none !important;
}
.setup-hint {
    font-size: 0.65em;
    font-weight: normal;
    color: #777;
}
input, button, select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
    box-sizing: border-box;
}
button {
    background-color: #3498db;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
}
button:disabled, input:disabled {
    opacity: 0.5;
    cursor: default;
}
.btn-end {
    background-color: #9b59b6;
    margin-top: 15px;
}
.btn-reset {
    background-color: #e67e22;
    margin-top: 5px;
}
.guard-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    font-weight: bold;
    margin-top: 5px;
}
.winner-text {
    text-align: center;
    color: #8e44ad;
    margin-top: 15px;
}
.home-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 14px 0 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    background-color: #7f8c8d;
    color: white;
    cursor: pointer;
    user-select: none;
}
.legal {
    max-width: 400px;
    margin: 16px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: #999;
    text-align: center;
}
.btn-secondary {
    background-color: #7f8c8d;
}
.btn-undo {
    background-color: #95a5a6;
}
.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    margin: 4px 0 8px;
}
.option-row label {
    width: 92px;
    flex: none;
}
.option-row select {
    flex: 1;
    min-width: 0;
    width: auto;
    padding: 4px 8px;
    margin: 0;
    font-size: 13px;
    border-radius: 6px;
    background-color: white;
}
.scores-btn {
    display: block;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: #3498db;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 0 14px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 0 #2379b0;
}
.scores-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}
.icon-toggle-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 15px 0 5px;
}
.icon-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    white-space: nowrap;
    color: #333;
    background-color: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 20px;
    padding: 6px 9px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.icon-toggle.toggle-off {
    opacity: 0.55;
    background-color: #f5f5f5;
    border-color: #ddd;
}
.round-heading {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #8e44ad;
    margin: 0 0 4px;
    user-select: none;
}
.choice {
    margin: 4px 0 10px;
}
.choice-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.choice-label {
    width: 92px;
    flex: none;
}
.segmented {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 6px;
}
.segmented label {
    flex: 1;
    position: relative;
    cursor: pointer;
}
.segmented input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
}
.segmented span {
    display: block;
    text-align: center;
    font-size: 13px;
    white-space: nowrap;
    color: #333;
    background-color: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 20px;
    padding: 6px 4px;
    user-select: none;
}
.segmented input:checked + span {
    color: white;
    font-weight: bold;
    background-color: #3498db;
    border-color: #3498db;
}
.segmented input:focus-visible + span {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}
.choice-blurb {
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: #999;
}
.round-note {
    text-align: center;
    font-size: 13px;
    color: #777;
    margin: 0 0 10px;
}
/* The scorepad. Header and rows share one set of column widths; the column
   being entered (bids or tricks) is the wide one. */
.pad {
    --bid: 40px;
    --tricks: 40px;
    --cols: minmax(0, 1fr) var(--bid) var(--tricks) 46px;
}
.pad-bids {
    --bid: 92px;
}
.pad-tricks {
    --tricks: 92px;
}
.pad-final {
    --cols: minmax(0, 1fr) 60px;
}
.pad-head {
    display: grid;
    grid-template-columns: var(--cols);
    column-gap: 5px;
    padding: 0 8px 4px;
    font-size: 10px;
    text-transform: uppercase;
    color: #999;
    user-select: none;
}
.pad-col {
    text-align: center;
}
.pad-col.active {
    color: #3498db;
    font-weight: bold;
}
.pad-score {
    text-align: right;
}
.pad-cell {
    display: flex;
    justify-content: center;
}
.pad-value {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}
.pad-value.empty {
    color: #ccc;
}
.step-line {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    background-color: #3498db;
    border-radius: 20px;
    padding: 6px 12px;
    margin: 0 0 12px;
    user-select: none;
}
.player-row {
    display: grid;
    grid-template-columns: var(--cols);
    align-items: center;
    column-gap: 5px;
    padding: 9px 6px;
    border: 2px solid #ccc;
    border-radius: 10px;
    margin-bottom: 8px;
    background-color: #fdfdfd;
}
.player-row.dealer {
    border-color: #8e44ad;
    background-color: #f7f0fa;
}
.player-row.first-place {
    border-color: #2ecc71;
    background-color: #ebfaf0;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
}
.player-name-block {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}
.player-name {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-sub {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}
.player-sub .up {
    color: #27ae60;
    font-weight: bold;
}
.player-sub .down {
    color: #c0392b;
    font-weight: bold;
}
.player-score {
    font-size: 20px;
    color: #27ae60;
    font-weight: bold;
    text-align: right;
}
.pad-final .player-score {
    font-size: 24px;
}
.player-score.negative {
    color: #c0392b;
}
.stepper {
    display: flex;
    align-items: center;
    gap: 2px;
}
.stepper button {
    width: 32px;
    height: 38px;
    padding: 0;
    margin: 0;
    font-size: 22px;
    line-height: 1;
    border-radius: 8px;
    touch-action: manipulation;
}
.stepper-value {
    width: 22px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}
.stepper-value.empty {
    color: #bbb;
}
.countdown {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(44, 62, 80, 0.94);
    color: white;
    font-weight: bold;
    font-size: 45vmin;
    line-height: 1;
    user-select: none;
}
.countdown.go {
    background-color: rgba(142, 68, 173, 0.96);
    font-size: 26vmin;
}
.tally {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    color: #e67e22;
    margin: 4px 0;
    user-select: none;
}
.tally.even {
    color: #27ae60;
}
.sheet-scroll {
    overflow-x: auto;
    margin: 0 -6px;
}
.sheet {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    text-align: center;
}
.sheet th, .sheet td {
    border: 1px solid #e0e0e0;
    padding: 4px 6px;
    white-space: nowrap;
}
.sheet th {
    background-color: #f4f4f9;
    color: #2c3e50;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sheet .bt {
    display: block;
    font-size: 11px;
    color: #999;
}
.sheet .tot {
    display: block;
    font-weight: bold;
    color: #2c3e50;
}
.sheet td.hit .bt {
    color: #27ae60;
}
.sheet td.miss .bt {
    color: #c0392b;
}
.sheet .tot.negative {
    color: #c0392b;
}
.sheet tr.pending td {
    background-color: #fdfdfd;
    color: #999;
}
.sheet tfoot td {
    font-weight: bold;
    background-color: #f4f4f9;
}
.sheet-key {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 8px 0 4px;
}
.rules {
    padding-left: 18px;
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.45;
}
.rules li {
    margin-bottom: 8px;
}
