/* ── Scoring App ────────────────────────────────────────── */

.scoring-app {
    margin: 0 auto;
    padding: 1.5rem 1rem;
    max-width: 44rem;
    width: 100%;
}

.scoring-app h1 {
    text-align: center;
    font-size: 1.8rem;
    color: #e2b96f;
    margin-bottom: 1rem;
}

/* ── Header row ────────────────────────────────────────── */

.scoring-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.scoring-header h1 { margin: 0; }

/* ── Scoreboard ────────────────────────────────────────── */

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

.scoreboard-player {
    position: relative;
    background: #16213e;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    transition: border-color 0.2s;
}
.scoreboard-avatar {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    object-fit: cover;
}

.scoreboard-player.is-dealer {
    border-color: #e2b96f;
}

.scoreboard-player .player-label {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.25rem;
}

.scoreboard-player .player-wind {
    font-size: 0.75rem;
    color: #e2b96f;
    margin-bottom: 0.4rem;
}

.scoreboard-player .player-score {
    font-size: 1.6rem;
    font-weight: 700;
    color: #eee;
}

.scoreboard-player .player-score.positive { color: #4caf50; }
.scoreboard-player .player-score.negative { color: #f44336; }

.player-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.action-btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 2px solid #444;
    background: #1a1a2e;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}

.action-btn:active { transform: scale(0.9); }

.action-btn.winner-btn.active {
    border-color: #4caf50;
    background: #4caf5033;
}

.action-btn.discarder-btn.active {
    border-color: #f44336;
    background: #f4433633;
}

.round-indicator {
    text-align: center;
    color: #e2b96f;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.win-type-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.win-type-btn {
    flex: 1;
    min-height: 2.75rem;
    padding: 0.5rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
    color: #ccc;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.win-type-btn.selected {
    border-color: #4fc3f7;
    background: #4fc3f722;
    color: #4fc3f7;
}

/* ── Hand Input ────────────────────────────────────────── */

.hand-input {
    background: #16213e;
    border: 1px solid #e2b96f55;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.hand-input h2 {
    color: #e2b96f;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

/* Selector buttons (winner, discarder, etc.) */
.selector-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selector-btn {
    min-width: 3.5rem;
    min-height: 3rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
    color: #ccc;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.selector-btn:hover { border-color: #888; }
.selector-btn.selected {
    border-color: #e2b96f;
    background: #e2b96f22;
    color: #e2b96f;
}

/* Toggle row (self-draw / discard) */
.toggle-row {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    flex: 1;
    min-height: 3rem;
    padding: 0.5rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
    color: #ccc;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.toggle-btn:hover { border-color: #888; }
.toggle-btn.selected {
    border-color: #4fc3f7;
    background: #4fc3f722;
    color: #4fc3f7;
}

/* Flower checkboxes */
.flower-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.flower-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.flower-checkbox .tile-img {
    width: 100%;
    opacity: 0.35;
    transition: opacity 0.15s;
}

.flower-checkbox.checked .tile-img {
    opacity: 1;
}

.flower-checkbox:hover { border-color: #888; }
.flower-checkbox.checked {
    border-color: #4caf50;
    background: #4caf5022;
}

/* Faan counter (Mode A) */
.faan-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.faan-input {
    width: 4rem;
    font-size: 2.5rem;
    font-weight: 700;
    color: #e2b96f;
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 2px solid #e2b96f55;
    outline: none;
    -moz-appearance: textfield;
}

.faan-input::-webkit-outer-spin-button,
.faan-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.faan-input:focus {
    border-bottom-color: #e2b96f;
}

.faan-btn {
    width: 3.5rem;
    height: 3.5rem;
    border: 2px solid #e2b96f55;
    border-radius: 50%;
    background: #2a2a4e;
    color: #e2b96f;
    font-size: 1.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}

.faan-btn:hover {
    background: #3a3a5e;
    border-color: #e2b96f;
}

.faan-btn:active { transform: scale(0.95); }

/* Mode tabs */
.mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
}

.mode-tab {
    flex: 1;
    padding: 0.6rem;
    background: #1a1a2e;
    color: #aaa;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-tab.active {
    background: #e2b96f22;
    color: #e2b96f;
}

/* Pattern checklist (Mode B) */
.pattern-checklist {
    max-height: 40vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4fc3f766 transparent;
}

.pattern-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #ffffff0a;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 2.75rem;
}

.pattern-item:hover { background: #ffffff0a; }

.pattern-item.checked {
    background: #4caf5015;
}

.pattern-item .pattern-name {
    flex: 1;
    color: #ddd;
    font-size: 0.95rem;
}

.pattern-item .pattern-pts {
    color: #e2b96f;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 3rem;
    text-align: right;
}

.pattern-item .pattern-check {
    color: #4caf50;
    font-size: 1.2rem;
    margin-left: 0.5rem;
    visibility: hidden;
}

.pattern-item.checked .pattern-check {
    visibility: visible;
}

.faan-total {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #e2b96f;
    padding: 0.75rem;
    border-top: 2px solid #e2b96f44;
    margin-top: 0.5rem;
}

.faan-warning {
    text-align: center;
    color: #f44336;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Situational toggles */
.situational-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.situational-toggle {
    width: max-width;
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 0.6rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
    color: #ccc;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.situational-toggle:hover { border-color: #888; }
.situational-toggle.checked {
    border-color: #4fc3f7;
    background: #4fc3f722;
    color: #4fc3f7;
}

/* Situational counters */
.situational-counters {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.sit-counter {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
}

.sit-counter-label {
    color: #ccc;
    font-size: 0.8rem;
}

.sit-counter-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sit-counter-btn {
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid #e2b96f55;
    border-radius: 50%;
    background: #2a2a4e;
    color: #e2b96f;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.15s;
}

.sit-counter-btn:hover { background: #3a3a5e; }
.sit-counter-btn:active { transform: scale(0.9); }

.sit-counter-value {
    color: #e2b96f;
    font-weight: 700;
    font-size: 1rem;
    min-width: 1.2rem;
    text-align: center;
}

/* Submit button */
.submit-hand {
    width: 100%;
    min-height: 3.5rem;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    background: #e2b96f;
    color: #1a1a2e;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 0.5rem;
}

.submit-hand:hover { background: #d4a85a; }
.submit-hand:active { transform: scale(0.98); }
.submit-hand:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Full Hand Tile Picker ─────────────────────────────── */

.hand-display {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 3.5rem;
    padding: 0.5rem;
    background: #0d1b2a;
    border: 1px solid #e2b96f44;
    border-radius: 8px;
    align-items: center;
}

.hand-display .meld-group {
    display: inline-flex;
    gap: 1px;
    padding: 2px 3px;
    border-bottom: 2px solid #e2b96f88;
    margin-right: 6px;
}

.hand-display .remaining-tile {
    display: inline-flex;
    margin-left: 2px;
}

.hand-display .tile-img.hand-tile {
    width: calc((100% - 26px) / 14);
    max-width: 3.5rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.hand-display .tile-img.hand-tile:active {
    transform: scale(0.9);
}

.hand-placeholder {
    color: #666;
    font-size: 0.9rem;
    width: 100%;
    text-align: center;
}

.clear-hand-btn {
    margin-top: 0.4rem;
    padding: 0.3rem 1rem;
    border: 1px solid #f4433655;
    border-radius: 6px;
    background: transparent;
    color: #f44336;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.clear-hand-btn:hover { background: #f4433622; }

.tile-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    user-select: none;
    -webkit-user-select: none;
}

.tile-picker.compact {
    flex-direction: row;
    flex-wrap: wrap;
}

.tile-picker.compact .tile-pick-label {
    display: none;
}

.tile-picker.compact .tile-pick-group {
    flex: 1 1 100%;
}

.tile-picker.compact .tile-pick-group:nth-last-child(-n+2) {
    flex: 1 1 auto;
}

.tile-pick-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tile-pick-label {
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tile-pick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
}

.tile-pick-wrap {
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}

.tile-pick-wrap:active { transform: scale(0.92); }

.tile-pick-wrap .tile-img {
    width: calc((100vw - 3.5rem) / 9 - 3px);
    max-width: 3rem;
    opacity: 0.35;
    transition: opacity 0.15s;
}

.tile-pick-wrap .tile-img.in-hand {
    opacity: 1;
}

.tile-pick-wrap .tile-img.maxed {
    box-shadow: inset 0 0 0 2px #f44336;
    border-radius: 4px;
}

.tile-count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: #e2b96f;
    color: #1a1a2e;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Hand History ──────────────────────────────────────── */

.hand-history {
    margin-bottom: 1.5rem;
}

.hand-history h3 {
    color: #e2b96f;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #16213e;
    border: 1px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 2.75rem;
}

.history-item:hover { background: #1a2744; }

.history-item .history-summary {
    color: #ccc;
    font-size: 0.9rem;
}

.history-item .history-summary .winner-name { color: #4caf50; font-weight: 600; }
.history-item .history-summary .draw-label { color: #888; font-style: italic; }

.history-item .history-faan {
    color: #e2b96f;
    font-weight: 600;
    font-size: 0.9rem;
}

.history-detail {
    padding: 0.5rem 0.75rem 0.75rem;
    background: #0f3460;
    border: 1px solid #4fc3f755;
    border-radius: 0 0 8px 8px;
    margin-top: -0.3rem;
}

.history-detail .payment-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.history-detail .payment-label {
    margin-right: 1rem;
}

/* ── Rules Config ──────────────────────────────────────── */

.rules-config {
    background: #16213e;
    border: 1px solid #e2b96f55;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.rules-config h2 {
    color: #e2b96f;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}
.session-manage-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.session-manage-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid #e2b96f55;
    background: #1a1a2e;
    color: #ccc;
    cursor: pointer;
}
.session-manage-btn:hover {
    background: #252545;
}
.session-manage-btn.delete {
    color: #e57373;
    border-color: #e5737355;
}
.session-manage-btn.delete:hover {
    background: #3a1a1a;
}

.rules-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ffffff0a;
    flex-wrap: wrap;
}

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

.rules-row .rules-label {
    color: #ccc;
    font-size: 0.9rem;
}

.seat-list {
    touch-action: auto;
}

.seat-list.drag-active {
    touch-action: none;
}

.name-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.15s;
}

.name-sub-row {
    display: flex;
    flex-direction: row;
    align-content: space-between;
    justify-content: space-between;
    width: 100%;
}

.name-row.drag-over {
    border-color: #4fc3f7;
    background: #4fc3f711;
}


.seat-wind-label {
    min-width: 3.5rem;
    color: #e2b96f;
    font-weight: 600;
}

.name-row input {
    flex: 1;
    padding: 0.4rem;
    background: #1a1a2e;
    border: 1px solid #e2b96f55;
    border-radius: 6px;
    color: #eee;
    font-size: 0.9rem;
    min-width: 0;
}

.player-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid #444;
    object-fit: cover;
    flex-shrink: 0;
}

.player-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a4e;
    color: #e2b96f;
    font-weight: 700;
    font-size: 1rem;
}

.avatar-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid #444;
    background: #1a1a2e;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.15s;
}

.avatar-btn:active { transform: scale(0.9); }

.player-select {
    flex: 1;
    min-width: 0;
    background: #2a2a4e;
    color: #eee;
    border: 1px solid #e2b96f55;
    border-radius: 6px;
    padding: 0.4rem 0.3rem;
    font-size: 0.9rem;
}
.player-select.locked {
    background: transparent;
    border-color: transparent;
    color: #ccc;
    min-height: 2.5rem;
}

/* ── Add Player Modal ──────────────────────────────────── */

.add-player-btn {
    flex: 1;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    border: 1px dashed #e2b96f88;
    border-radius: 8px;
    background: transparent;
    color: #e2b96f;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.add-player-btn:hover { background: #e2b96f15; }
.add-player-btn:active { transform: scale(0.98); }

.modal-title {
    color: #e2b96f;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* ── Players Modal Tabs ────────────────────────────────── */

.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
}

.modal-tab {
    flex: 1;
    padding: 0.6rem;
    background: #1a1a2e;
    color: #aaa;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-tab.active {
    background: #e2b96f22;
    color: #e2b96f;
}

/* ── Select tab (compact) ─────────────────────────────── */

.no-players {
    color: #666;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.player-select-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 50vh;
    overflow-y: auto;
}

.player-select-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid #333;
    border-radius: 8px;
    background: #16213e;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 2.5rem;
}

.player-select-item:hover { border-color: #e2b96f88; background: #1a2744; }
.player-select-item:active { transform: scale(0.98); }

.player-avatar-sm {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    border: 1px solid #444;
    object-fit: cover;
    flex-shrink: 0;
}

.player-avatar-sm.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a4e;
    color: #e2b96f;
    font-weight: 700;
    font-size: 0.8rem;
}

.player-select-name {
    color: #eee;
    font-size: 0.95rem;
}

/* ── Manage tab (cards) ───────────────────────────────── */

.player-manage-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 40vh;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #333;
    border-radius: 10px;
    background: #16213e;
    min-height: 3.5rem;
}

.player-card-avatar {
    flex-shrink: 0;
}

.player-card-name {
    color: #eee;
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
}

.player-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.delete-img-btn {
    color: #f44336;
    border-color: #f4433655;
}

.delete-player-btn {
    color: #f44336;
    border-color: #f4433655;
}

.new-player-form {
    border-top: 1px solid #ffffff15;
    padding-top: 1rem;
}

.new-player-form h3 {
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.new-player-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.new-player-avatar-wrap {
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.new-player-avatar-wrap:active { transform: scale(0.9); }

.camera-placeholder {
    font-size: 1.1rem;
    color: #888;
}

.new-player-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.6rem;
    background: #1a1a2e;
    border: 1px solid #e2b96f55;
    border-radius: 6px;
    color: #eee;
    font-size: 1rem;
    min-height: 2.5rem;
}

.new-player-add-btn {
    min-height: 2.5rem;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: #e2b96f;
    color: #1a1a2e;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.new-player-add-btn:hover { background: #d4a85a; }
.new-player-add-btn:active { transform: scale(0.95); }

.drag-handle {
    color: #666;
    font-size: 1.4rem;
    cursor: grab;
    user-select: none;
    padding: 0 0.5rem;
    touch-action: none;
    line-height: 1rem;
    flex-shrink: 0;
}

.drag-handle:active { cursor: grabbing; }

.rules-row select {
    background: #2a2a4e;
    color: #eee;
    border: 1px solid #e2b96f55;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    min-height: 2.5rem;
}

/* ── Session Summary ───────────────────────────────────── */

.session-summary {
    text-align: center;
    padding: 2rem 1rem;
}

.session-summary h2 {
    color: #e2b96f;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.final-rankings {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.ranking-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #16213e;
    border: 1px solid #333;
    border-radius: 10px;
    min-height: 3rem;
}

.ranking-row:first-child {
    border-color: #e2b96f;
    background: #e2b96f15;
}

.ranking-row .rank { color: #e2b96f; font-weight: 700; font-size: 1.1rem; }
.ranking-row .rank-name { color: #eee; font-size: 1rem; }
.ranking-row .rank-score { font-weight: 700; font-size: 1.2rem; }

.new-session-btn {
    min-height: 3.5rem;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    background: #e2b96f;
    color: #1a1a2e;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.new-session-btn:hover { background: #d4a85a; }

/* ── Scoring Reference panel ───────────────────────────── */

.ref-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.125rem;
    height: 3.125rem;
    border-radius: 50%;
    background: #4fc3f7ee;
    border: none;
    color: #1a1a2e;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.ref-toggle:hover { transform: scale(1.05); }
.ref-toggle:active { transform: scale(0.95); }

/* ── Session Browser ───────────────────────────────────── */

.session-browser {
    margin-bottom: 1.5rem;
}

.browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.browser-header h2 {
    color: #e2b96f;
    font-size: 1.2rem;
    margin: 0;
    flex: 1;
    text-align: center;
}

.back-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2b96f55;
    border-radius: 8px;
    background: transparent;
    color: #e2b96f;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.back-btn:hover { background: #e2b96f22; }

.browser-actions {
    display: flex;
    gap: 0.5rem;
}

.export-btn, .import-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #4fc3f755;
    border-radius: 8px;
    background: transparent;
    color: #4fc3f7;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.export-btn:hover, .import-btn:hover { background: #4fc3f722; }

.no-sessions {
    text-align: center;
    color: #666;
    font-size: 1rem;
    padding: 2rem;
}

.day-group {
    margin-bottom: 1.25rem;
}

.day-header {
    color: #e2b96f;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #e2b96f44;
    margin-bottom: 0.5rem;
}

.session-card {
    background: #16213e;
    border: 1px solid #333;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.session-card.active-session {
    border-color: #e2b96f88;
    background: #16213e;
}

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.session-card-header:active { background: #1a2744; }

.session-players {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 1;
}

.session-player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.sp-avatar {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    object-fit: cover;
}
.sp-name {
    color: #ccc;
    font-size: 0.8rem;
}

.sp-score {
    font-weight: 700;
    font-size: 1rem;
    color: #eee;
}

.sp-score.positive { color: #4caf50; }
.sp-score.negative { color: #f44336; }

.session-hands {
    color: #888;
    font-size: 0.8rem;
    white-space: nowrap;
}

.session-detail {
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid #ffffff0a;
}

.hand-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.hand-num {
    color: #e2b96f;
    font-weight: 600;
    min-width: 2rem;
}

.hand-desc {
    color: #ccc;
}

.delete-session-btn {
    display: block;
    margin: 0.75rem auto 0;
    padding: 0.5rem 1.5rem;
    border: 1px solid #f4433655;
    border-radius: 8px;
    background: transparent;
    color: #f44336;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.delete-session-btn:hover { background: #f4433622; }

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 480px) {
    .scoreboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .scoreboard-player .player-label,
    .scoreboard-player .player-wind {
        display: inline;
    }


    .scoreboard-player .player-wind {
        margin-left: 1rem;
        margin-bottom: 0;
    }

    .scoring-app {
        padding: 1rem 0.75rem;
    }

    .scoring-app h1 {
        font-size: 1.4rem;
    }

    .flower-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .selector-btn {
        min-width: 3rem;
        font-size: 0.9rem;
    }

    .situational-toggle {
        min-height: 0;
        padding: 0.4rem 0.2rem;
    }

}

@media (hover: none) and (pointer: coarse) {
    .selector-btn:hover,
    .toggle-btn:hover,
    .flower-checkbox:hover,
    .situational-toggle:hover,
    .pattern-item:hover,
    .history-item:hover { background: inherit; border-color: inherit; }

    .selector-btn:active { border-color: #888; }
    .toggle-btn:active { border-color: #888; }
    .submit-hand:active { transform: scale(0.98); }
}
