* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide content until role is determined */
.container.loading {
    visibility: hidden;
}

/* Site logos */
.logo-container {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.3s ease;
}

.logo-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.logo-link {
    transition: transform 0.2s ease;
    opacity: 0.8;
}

.logo-link:hover {
    transform: scale(1.1);
    opacity: 1;
}

.site-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

#kfLogo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: contain;
    padding: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Lock Toggle */
.lock-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    background: rgba(45, 55, 72, 0.8);
    border-radius: 8px;
    user-select: none;
}

.lock-toggle input {
    display: none;
}

.lock-slider {
    width: 40px;
    height: 22px;
    background: #4a5568;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.lock-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.lock-toggle input:checked + .lock-slider {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.lock-toggle input:checked + .lock-slider::after {
    transform: translateX(18px);
}

.lock-text {
    font-size: 0.9rem;
    color: #a0aec0;
    font-weight: 600;
}

.lock-toggle input:checked ~ .lock-text {
    color: #48bb78;
}

/* Locked button state */
#randomizeBtn.locked,
#manualNumbersBtn.locked,
#clearNumbersBtn.locked,
#randomizeNamesBtn.locked,
#clearBtn.locked,
#espnCheckGameBtn.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.main-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.board-section {
    flex: 1;
    min-width: 600px;
}

.team-label {
    font-weight: bold;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #667eea;
}

.team-label.team-col {
    text-align: center;
    padding-left: 40px;
    margin-bottom: 10px;
}

.team-label.team-row {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding-right: 10px;
    margin-right: 10px;
}

.grid-wrapper {
    display: flex;
    align-items: center;
}

.grid-container {
    display: grid;
    grid-template-columns: 40px repeat(10, 1fr);
    grid-template-rows: 40px repeat(10, 1fr);
    gap: 2px;
    background: #2d3748;
    padding: 2px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.corner-cell {
    background: #1a1a2e;
    border-radius: 8px 0 0 0;
}

.col-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.col-header:last-child {
    border-radius: 0 8px 0 0;
}

.row-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.row-header:last-of-type {
    border-radius: 0 0 0 8px;
}

.square {
    background: #1a1a2e;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    text-align: center;
    padding: 4px;
    min-width: 50px;
    min-height: 50px;
    word-break: break-word;
    overflow: hidden;
    position: relative;
}

.square-number {
    position: absolute;
    font-size: 1rem;
    opacity: 0.25;
    font-weight: 400;
    pointer-events: none;
}

.square.filled .square-number {
    display: none;
}

.square:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
    z-index: 10;
}

.square.filled {
    font-weight: 600;
}

.square.winner {
    outline: 6px solid;
    outline-offset: -3px;
    animation: pulse 1s infinite, rainbow-outline 2s linear infinite;
    z-index: 20;
}

@keyframes rainbow-outline {
    0% { outline-color: #ff0000; }
    14% { outline-color: #ff8000; }
    28% { outline-color: #ffff00; }
    42% { outline-color: #00ff00; }
    57% { outline-color: #00ffff; }
    71% { outline-color: #0080ff; }
    85% { outline-color: #ff00ff; }
    100% { outline-color: #ff0000; }
}

/* Trophy only on past-winner (completed quarters), not current winner */
.square.past-winner::after {
    content: '🏆';
    position: absolute;
    font-size: 1.0rem;
    top: 2px;
    right: 2px;
}

.col-header.winner,
.row-header.winner {
    background: linear-gradient(135deg, #f6e05e 0%, #ecc94b 100%);
    color: #16213e;
    animation: pulse 1s infinite;
}

.col-header.reverse-winner,
.row-header.reverse-winner {
    background: linear-gradient(135deg, #e8e8e8 0%, #c4c4c4 50%, #a8a8a8 100%);
    color: #1a202c;
    animation: pulse-subtle 1s infinite;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Quarterly Numbers Mode Styles */
.corner-cell.quarterly-mode {
    padding: 0;
    overflow: hidden;
}

.corner-quarters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    font-size: 0.65rem;
    font-weight: bold;
}

.corner-q {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: all 0.3s;
}

.corner-q.active {
    opacity: 1;
    background: rgba(102, 126, 234, 0.3);
}

.corner-q1 { border-bottom: 1px solid rgba(255,255,255,0.1); border-right: 1px solid rgba(255,255,255,0.1); }
.corner-q2 { border-bottom: 1px solid rgba(255,255,255,0.1); }
.corner-q3 { border-right: 1px solid rgba(255,255,255,0.1); }

.col-header.quarterly-mode,
.row-header.quarterly-mode {
    padding: 0;
    overflow: hidden;
}

.header-quarters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    font-size: 0.7rem;
}

.header-q {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.35;
    transition: all 0.3s;
    font-weight: bold;
}

.header-q.active {
    opacity: 1;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.15);
}

.header-q1 { border-bottom: 1px solid rgba(255,255,255,0.15); border-right: 1px solid rgba(255,255,255,0.15); }
.header-q2 { border-bottom: 1px solid rgba(255,255,255,0.15); }
.header-q3 { border-right: 1px solid rgba(255,255,255,0.15); }

/* Quarterly mode winner highlighting */
.col-header.quarterly-mode.winner .header-q.active,
.row-header.quarterly-mode.winner .header-q.active {
    background: linear-gradient(135deg, #f6e05e 0%, #ecc94b 100%);
    color: #16213e;
}

.col-header.quarterly-mode.reverse-winner .header-q.active,
.row-header.quarterly-mode.reverse-winner .header-q.active {
    background: linear-gradient(135deg, #e8e8e8 0%, #c4c4c4 50%, #a8a8a8 100%);
    color: #1a202c;
}

.square:last-child {
    border-radius: 0 0 8px 0;
}

/* Sidebar */
.sidebar {
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-feed, .payouts-section {
    background: rgba(45, 55, 72, 0.8);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.score-feed h2, .payouts-section h2 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.team-name {
    font-size: 0.875rem;
    color: #a0aec0;
    margin-bottom: 5px;
    text-align: center;
}

.score {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
}

.score-divider {
    font-size: 2rem;
    color: #4a5568;
}

.quarter-info {
    text-align: center;
    padding: 10px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.payout-per-minute {
    text-align: center;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #a0aec0;
}

.payout-per-minute-value {
    font-weight: bold;
    color: #68d391;
}

.payout-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payout-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.payout-item.final {
    background: linear-gradient(135deg, rgba(246, 224, 94, 0.2) 0%, rgba(236, 201, 75, 0.2) 100%);
    border: 1px solid rgba(246, 224, 94, 0.3);
}

.payout-item.current {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.payout-item.zero-payout {
    opacity: 0.5;
}

.payout-time-score {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quarter-label {
    font-weight: bold;
    color: #667eea;
    font-size: 0.85rem;
    white-space: nowrap;
}

.payout-score {
    font-size: 0.8rem;
    color: #a0aec0;
}

.payout-item .winner {
    text-align: center;
    color: #a0aec0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payout-item .winner.has-winner {
    color: #48bb78;
}

.payout-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.payout-minutes {
    font-size: 0.75rem;
    color: #a0aec0;
}

.amount {
    font-weight: bold;
    color: #48bb78;
    white-space: nowrap;
}

.payout-delete {
    background: transparent;
    border: none;
    color: #718096;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 8px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.payout-delete:hover {
    opacity: 1;
    color: #e53e3e;
}

.total-pot {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #4a5568;
    font-size: 1.2rem;
    font-weight: bold;
}

#totalPotDisplay {
    color: #f6e05e;
}

/* Settings Section */
.settings-section {
    background: rgba(45, 55, 72, 0.8);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.settings-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-collapse-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(74, 85, 104, 0.6);
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    line-height: 1;
}

.settings-collapse-btn:hover {
    background: rgba(74, 85, 104, 0.9);
}

.collapse-icon {
    transition: transform 0.2s ease;
}

.settings-section.collapsed .collapse-icon {
    transform: rotate(0deg);
}

.settings-section.collapsed .settings-collapse-btn .collapse-icon::after {
    content: '+';
}

.settings-section.collapsed .settings-collapse-btn .collapse-icon {
    font-size: 0;
}

.settings-section.collapsed .settings-collapse-btn .collapse-icon::after {
    font-size: 1.2rem;
}

.settings-content {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: visible;
}

.settings-section.collapsed .settings-content {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.settings-section.collapsed .settings-header {
    margin-bottom: 0;
}

.settings-section.collapsed {
    padding-bottom: 15px;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.settings-lock {
    padding: 4px 8px;
    background: rgba(45, 55, 72, 0.5);
}

.settings-lock .lock-text {
    font-size: 1rem;
}

/* Admin Controls in Settings */
.admin-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #4a5568;
}

.admin-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.lock-toggle-small {
    padding: 4px 8px;
    background: rgba(45, 55, 72, 0.5);
}

.lock-toggle-small .lock-slider {
    width: 32px;
    height: 18px;
    border-radius: 9px;
}

.lock-toggle-small .lock-slider::after {
    width: 14px;
    height: 14px;
    top: 2px;
    left: 2px;
}

.lock-toggle-small input:checked + .lock-slider::after {
    transform: translateX(14px);
}

.lock-toggle-small .lock-text {
    font-size: 0.85rem;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #a0aec0;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Tooltip */
.tooltip-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    color: #a0aec0;
    transition: color 0.2s;
}

.tooltip-icon:hover,
.tooltip-icon:focus {
    color: #667eea;
    outline: none;
}

.tooltip-icon svg {
    display: block;
}

.tooltip-content {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 12px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: normal;
    color: #e2e8f0;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    text-align: left;
    word-break: break-word;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2d3748;
}

.tooltip-icon:hover .tooltip-content,
.tooltip-icon:focus .tooltip-content {
    opacity: 1;
    visibility: visible;
}

.tooltip-content strong {
    color: #667eea;
}

/* Segmented Control for Payoff Type */
.segmented-control {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 4px;
    gap: 0;
}

.segmented-control input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control .segment {
    position: relative;
    z-index: 2;
    padding: 10px 16px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: #a0aec0;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.2s;
    user-select: none;
}

.segmented-control .segment:hover {
    color: #e2e8f0;
}

.segmented-control input[type="radio"]:checked + input + label:first-of-type,
.segmented-control input[type="radio"]:first-of-type:checked ~ label:first-of-type {
    color: #fff;
}

.segmented-control input[type="radio"]:last-of-type:checked ~ label:last-of-type {
    color: #fff;
}

.segment-highlight {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    transition: transform 0.2s ease;
    z-index: 1;
}

.segmented-control input[type="radio"]:last-of-type:checked ~ .segment-highlight {
    transform: translateX(100%);
}

/* Disabled state for non-admins */
.segmented-control.disabled .segment {
    cursor: default;
    pointer-events: none;
}

.segmented-control.disabled {
    opacity: 0.7;
}

/* Setting text input */
.setting-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.setting-input:focus {
    outline: none;
    border-color: #667eea;
}

.setting-input:disabled {
    color: #a0aec0;
    cursor: default;
}

.pot-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0 12px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.pot-input-wrapper:focus-within {
    border-color: #667eea;
}

.currency-symbol {
    color: #48bb78;
    font-weight: bold;
    font-size: 1.1rem;
}

.pot-input-wrapper input[type="number"] {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    color: #e2e8f0;
    font-size: 1rem;
    width: 100%;
}

.pot-input-wrapper input[type="number"]:focus {
    outline: none;
}

.pot-input-wrapper input[type="number"]:disabled {
    color: #a0aec0;
    cursor: default;
}

/* Hide number input spinners */
.pot-input-wrapper input[type="number"]::-webkit-outer-spin-button,
.pot-input-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pot-input-wrapper input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Setting display (read-only values) */
.setting-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.setting-display .setting-label {
    margin-bottom: 0;
}

.setting-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #f6e05e;
}

/* Quarter Payouts Inputs */
.quarter-payouts-inputs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quarter-payout-input {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
    flex: 1;
    min-width: 70px;
}

.quarter-payout-input:focus-within {
    border-color: #667eea;
}

.quarter-payout-input label {
    font-size: 0.8rem;
    color: #a0aec0;
    min-width: 28px;
}

.quarter-payout-input input[type="number"] {
    width: 40px;
    background: transparent;
    border: none;
    padding: 6px 2px;
    color: #e2e8f0;
    font-size: 0.95rem;
    text-align: right;
}

.quarter-payout-input input[type="number"]:focus {
    outline: none;
}

.quarter-payout-input input[type="number"]:disabled {
    color: #a0aec0;
    cursor: default;
}

/* Hide number input spinners for quarter payouts */
.quarter-payout-input input[type="number"]::-webkit-outer-spin-button,
.quarter-payout-input input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quarter-payout-input input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.quarter-payouts-validation {
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 1.2em;
}

.quarter-payouts-validation.error {
    color: #fc8181;
}

.quarter-payouts-validation.success {
    color: #68d391;
}

#quarterPayoutsGroup {
    display: none;
}

#quarterPayoutsGroup.visible {
    display: block;
}

/* Quarterly Numbers Group */
#quarterlyNumbersGroup {
    display: none;
}

#quarterlyNumbersGroup.visible {
    display: block;
}

/* Reverse Payouts Group */
#reversePayoutsGroup {
    display: none;
}

#reversePayoutsGroup.visible {
    display: block;
}

.reverse-payouts-inputs {
    margin-top: 10px;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: #4a5568;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #667eea;
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label-text {
    font-size: 0.9rem;
    color: #a0aec0;
}

/* Reverse winner square styling */
.square.reverse-winner {
    outline: 4px solid #c4c4c4;
    outline-offset: -2px;
    animation: pulse-subtle 1s infinite;
    z-index: 15;
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.6);
}

.square.reverse-winner::before {
    content: 'R';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.55rem;
    font-weight: 700;
    color: #1a202c;
    background: linear-gradient(135deg, #e8e8e8 0%, #c4c4c4 100%);
    border-radius: 3px;
    padding: 1px 3px;
    z-index: 1;
}

@keyframes pulse-subtle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.square.past-reverse-winner {
    box-shadow: inset 0 0 0 2px rgba(192, 192, 192, 0.6);
}

.square.past-reverse-winner::before {
    content: 'R';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.5rem;
    font-weight: 700;
    color: #1a202c;
    background: rgba(192, 192, 192, 0.8);
    border-radius: 3px;
    padding: 1px 3px;
    z-index: 1;
}

/* Reverse payout item styling */
.payout-item.reverse {
    background: rgba(192, 192, 192, 0.1);
    border-left: 3px solid #c4c4c4;
}

/* Modal for entering names */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2d3748;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-bottom: 20px;
}

#nameInput {
    margin-bottom: 10px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: #1a1a2e;
    color: white;
}

.modal-content input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons .btn {
    flex: 1;
}

.btn-secondary {
    background: #4a5568;
}

.btn-danger {
    background: linear-gradient(135deg, #fc8181 0%, #e53e3e 100%);
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

.btn-blue {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.btn-blue:hover {
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .board-section {
        min-width: auto;
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .score-feed, .payouts-section, .settings-section {
        flex: 1;
        min-width: 280px;
    }
}

@media (max-width: 600px) {
    .square {
        min-width: 35px;
        min-height: 35px;
        font-size: 0.6rem;
    }
    
    .col-header, .row-header {
        font-size: 0.9rem;
    }
    
    /* Quarterly mode smaller screens */
    .header-quarters {
        font-size: 0.5rem;
    }
    
    .header-q.active {
        font-size: 0.7rem;
    }
    
    .corner-quarters {
        font-size: 0.5rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    /* Manual numbers modal on small screens */
    .manual-number-input {
        width: 28px;
        height: 36px;
        font-size: 0.95rem;
    }
    
    .manual-numbers-row {
        gap: 4px;
    }
}

/* Share Modal */
.share-modal-content {
    max-width: 500px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #a0aec0;
}

.form-group input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: #1a1a2e;
    color: white;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input.input-locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: #12121f;
}

.share-lock-section {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.share-lock-section .lock-toggle {
    margin: 0;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
}

.password-toggle:hover {
    opacity: 1;
}

.eye-icon {
    width: 20px;
    height: 20px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 0.8rem;
}

.share-links {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.link-copy {
    display: flex;
    gap: 10px;
}

.link-copy input {
    flex: 1;
    font-size: 0.85rem;
}

/* Role Indicator */
.role-indicator {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 10px;
}

.role-indicator.admin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.role-indicator.player {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.role-indicator.guest {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
}

/* Modal close button */
.modal-close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid #2d3748;
    border-radius: 50%;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal-close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.modal-content {
    position: relative;
}

/* Share warning */
.share-warning {
    color: #f6ad55;
    font-size: 0.9rem;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(246, 173, 85, 0.1);
    border: 1px solid rgba(246, 173, 85, 0.3);
    border-radius: 8px;
}

/* Access Modal */
.access-modal-content {
    max-width: 400px;
    text-align: center;
}

.access-modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.access-description {
    color: #a0aec0;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.role-toggle {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.toggle-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.toggle-option:hover {
    background: rgba(102, 126, 234, 0.2);
}

.toggle-option input[type="radio"] {
    display: none;
}

.toggle-option input[type="radio"]:checked + .toggle-label {
    color: #667eea;
}

.toggle-option:has(input:checked) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.2);
}

.toggle-label {
    font-weight: 600;
    font-size: 1rem;
}

.access-error {
    background: rgba(229, 62, 62, 0.2);
    border: 1px solid #e53e3e;
    color: #fc8181;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Share note */
.share-note {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

/* Manual Numbers Modal */
.manual-numbers-content {
    max-width: 480px;
}

.manual-numbers-quarter-select {
    margin-bottom: 20px;
}

.manual-numbers-section {
    margin-bottom: 20px;
}

.manual-numbers-section .setting-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #a0aec0;
}

.manual-numbers-row {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.manual-number-input {
    width: 36px;
    height: 42px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: #1a1a2e;
    color: white;
    transition: border-color 0.2s, background-color 0.2s;
}

.manual-number-input:focus {
    outline: none;
    border-color: #667eea;
    background: #252540;
}

.manual-number-input.error {
    border-color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
}

.manual-numbers-error {
    color: #fc8181;
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 20px;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast-notification.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.toast-notification.warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.toast-notification.error {
    background: linear-gradient(135deg, #fc8181 0%, #e53e3e 100%);
    color: white;
}

.toast-notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Save Button */
#saveChangesBtn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    transition: all 0.2s;
}

#saveChangesBtn.has-changes {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    animation: pulseGlow 2s infinite;
}

#saveChangesBtn.has-conflict,
#playerSaveBtn.has-conflict {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    animation: pulseGlowWarning 2s infinite;
}

#saveChangesBtn:disabled {
    opacity: 0.7;
    cursor: default;
    transform: none;
    box-shadow: none;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(72, 187, 120, 0.5); }
    50% { box-shadow: 0 0 20px rgba(72, 187, 120, 0.8); }
}

@keyframes pulseGlowWarning {
    0%, 100% { box-shadow: 0 0 5px rgba(237, 137, 54, 0.5); }
    50% { box-shadow: 0 0 20px rgba(237, 137, 54, 0.8); }
}

/* Save Confirmation Modal */
.save-confirm-content {
    max-width: 450px;
    text-align: center;
}

.save-confirm-warning {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.save-confirm-note {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(246, 173, 85, 0.1);
    border: 1px solid rgba(246, 173, 85, 0.3);
    border-radius: 8px;
}

.save-confirm-note strong {
    color: #f6ad55;
}

/* Score Inputs for Update Score Modal */
.score-inputs {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}

.score-inputs .form-group {
    flex: 1;
    max-width: 150px;
}

.score-inputs label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.score-inputs input[type="number"] {
    width: 100%;
    padding: 12px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: #1a202c;
    color: white;
    transition: border-color 0.2s;
}

.score-inputs input[type="text"],
.score-inputs select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    text-align: center;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: #1a202c;
    color: white;
    transition: border-color 0.2s;
}

.score-inputs input[type="text"]:focus,
.score-inputs select:focus {
    outline: none;
    border-color: #667eea;
}

.score-inputs input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Disabled state for score inputs - lighter to show non-editable */
.score-inputs input:disabled,
.score-inputs select:disabled {
    background: #4a5568;
    border-color: #718096;
    color: #a0aec0;
    cursor: not-allowed;
}

.score-inputs label.disabled {
    color: #a0aec0;
}

.score-inputs input[type="number"]::-webkit-inner-spin-button,
.score-inputs input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-inputs input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ESPN Live Scores Settings */
.espn-settings {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.espn-game-id-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.espn-game-id-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85em;
    color: #a0aec0;
    width: 100%;
    margin-bottom: 4px;
}

.espn-game-id-row input {
    flex: 1;
    min-width: 0;
}

.espn-league-toggle {
    margin-bottom: 10px;
}

.espn-league-toggle .segmented-control {
    max-width: 200px;
}

.espn-status {
    margin-top: 8px;
    font-size: 0.85em;
    color: #a0aec0;
}

.espn-status.success {
    color: #68d391;
}

.espn-status.error {
    color: #fc8181;
}

.espn-status.loading {
    color: #63b3ed;
}

#espnCheckGameBtn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    transition: all 0.2s;
}

#espnCheckGameBtn.id-changed {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    animation: pulseGlow 2s infinite;
}

/* Team name inputs disabled when live scores enabled */
.setting-group.live-disabled .setting-label {
    color: #718096;
}

.setting-group.live-disabled input {
    background: rgba(0, 0, 0, 0.3);
    color: #718096;
    cursor: not-allowed;
}

/* Live score indicator */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    font-size: 0.75em;
    color: #ef4444;
    animation: pulse-live 2s ease-in-out infinite;
}

.live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: blink-live 1s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes blink-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Refresh button disabled state */
#liveRefreshBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#espnCheckGameBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Last updated text for live scores */
.last-updated {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.last-updated > span,
.last-updated > svg {
    opacity: 0.7;
}

.last-updated:hover > span,
.last-updated:hover > svg {
    opacity: 1;
}

/* Shuffle Animation for Randomize Names */
.square.shuffle-moving {
    z-index: 100;
    transition: transform var(--shuffle-duration, 1.5s) cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Wave Animation for Randomize Numbers */
:root {
    --shuffle-duration: 1.5s;
    --number-wave-duration: 0.4s;
    --number-wave-delay: 0.08s;
}

@keyframes number-flip {
    0% { transform: scaleY(1); opacity: 1; }
    40% { transform: scaleY(0); opacity: 0.5; }
    60% { transform: scaleY(0); opacity: 0.5; }
    100% { transform: scaleY(1); opacity: 1; }
}

.col-header.number-wave,
.row-header.number-wave {
    animation: number-flip var(--number-wave-duration) ease-in-out;
}
