body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #2c2c2c;
    color: #ffffff;
    padding: 20px;
    padding-top: 80px; /* Space for sticky tab bar */
    margin: 0;
}

h1 {
    margin-bottom: 20px;
    transition: opacity 0.5s ease;
}

h1.header-visible {
    opacity: 1;
}

h1.header-hidden {
    opacity: 0;
}

/* ========== TAB BAR ========== */
.tab-bar {
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    padding: 12px 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    gap: 10px;
}

.tab-btn {
    color: #aaa;
    font-weight: bold;
    padding: 10px 24px;
    border-radius: 8px;
    background-color: #2c2c2c;
    border: 2px solid #444;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.15s;
    flex: 1;
    max-width: 200px;
    text-align: center;
}

.tab-btn:hover {
    background-color: #3a3a3a;
    color: #fff;
    border-color: #4CAF50;
    transform: translateY(-1px);
}

.tab-btn.active {
    background-color: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

/* ========== SECTIONS CONTAINER ========== */
.sections-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Individual section styling */
.section {
    display: none; /* Hidden by default; JS shows the active tab */
    background-color: #3a3a3a;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.section.active-tab {
    display: block;
}

.section h2 {
    margin-top: 0;
    color: #4CAF50;
}

.section h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
}

/* ========== INPUT SECTION ========== */
.input-section {
    margin-bottom: 15px;
}

.input-section input {
    padding: 8px;
    margin: 5px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #2c2c2c;
    color: #fff;
}

.input-section input::placeholder {
    color: #aaa;
}

/* ========== BUTTONS ========== */
button {
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background-color: #45a049;
}

/* Disabled button state */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #666;
}

/* ========== SAVE / LOAD BUTTONS ========== */
.save-load-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.save-list-btn {
    background-color: #2196F3;
    font-size: 13px;
    padding: 8px 14px;
}

.save-list-btn:hover {
    background-color: #1976D2;
}

.load-list-btn {
    background-color: #FF9800;
    font-size: 13px;
    padding: 8px 14px;
}

.load-list-btn:hover {
    background-color: #F57C00;
}

.save-load-msg {
    font-size: 12px;
    color: #4CAF50;
    min-height: 18px;
    margin-top: 4px;
    transition: opacity 0.3s;
}

/* ========== PARTICIPANT LIST ========== */
.list-section {
    margin: 15px 0;
    text-align: left;
}

.list-section ul {
    list-style: none;
    padding: 0;
}

.list-section li {
    background-color: #2c2c2c;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #444;
}

/* Container for buttons */
.action-buttons {
    display: flex;
    gap: 5px;
}

/* Edit button styling */
.edit-btn {
    padding: 5px 10px;
    font-size: 14px;
    background-color: #FFC107;
    color: #2c2c2c;
}

.edit-btn:hover {
    background-color: #e0a800;
}

/* Remove button styling */
.remove-btn {
    padding: 5px 10px;
    font-size: 12px;
    background-color: #f44336;
}

.remove-btn:hover {
    background-color: #da190b;
}

/* Edit mode container */
.edit-mode {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    width: 100%;
}

.edit-mode input {
    padding: 5px;
    border-radius: 3px;
    border: 1px solid #555;
    background-color: #444;
    color: #fff;
    flex: 1 1 120px;
}

.save-btn {
    padding: 5px 10px;
    background-color: #4CAF50;
    font-size: 12px;
}

.cancel-btn {
    padding: 5px 10px;
    background-color: #777;
    font-size: 12px;
}

/* ========== POT PANEL ========== */
.pot-panel {
    background-color: #2c2c2c;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 16px;
    margin-top: 18px;
    text-align: left;
}

.pot-panel h3 {
    margin: 0 0 12px 0;
    color: #FFD700;
    font-size: 1.05em;
    text-align: center;
}

.pot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

.pot-row label {
    font-size: 14px;
    color: #ccc;
    white-space: nowrap;
}

.pot-row .pot-value {
    font-weight: bold;
    font-size: 16px;
    color: #4CAF50;
}

.pot-row input[type="number"] {
    width: 80px;
    padding: 6px 8px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #3a3a3a;
    color: #fff;
    font-size: 14px;
    text-align: right;
}

.pot-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
    margin: 12px 0;
}

.pot-total-label {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.pot-total-value {
    font-size: 22px;
    font-weight: bold;
    color: #FFD700;
}

.pot-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.pot-edit-input {
    width: 90px;
    padding: 6px 8px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #3a3a3a;
    color: #fff;
    font-size: 14px;
    text-align: right;
}

.pot-override-btn {
    background-color: #FF9800;
    font-size: 12px;
    padding: 6px 12px;
}

.pot-override-btn:hover {
    background-color: #F57C00;
}

.pot-reset-btn {
    background-color: #f44336;
    font-size: 12px;
    padding: 6px 12px;
}

.pot-reset-btn:hover {
    background-color: #da190b;
}

/* Splits display */
.splits-section {
    margin-top: 12px;
}

.splits-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #aaa;
    text-align: center;
}

.split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.split-row span {
    font-size: 14px;
}

.split-label {
    color: #ccc;
}

.split-value {
    font-weight: bold;
    color: #4CAF50;
}

.split-leftover {
    color: #FF9800 !important;
    font-style: italic;
}

/* ========== POT ADD/REMOVE BUTTONS ========== */
.pot-adjust-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.pot-adjust-input {
    width: 80px;
    padding: 6px 8px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #3a3a3a;
    color: #fff;
    font-size: 14px;
    text-align: right;
}

.pot-add-btn {
    background-color: #4CAF50;
    font-size: 12px;
    padding: 6px 12px;
    font-weight: bold;
}

.pot-add-btn:hover {
    background-color: #45a049;
}

.pot-remove-btn {
    background-color: #f44336;
    font-size: 12px;
    padding: 6px 12px;
    font-weight: bold;
}

.pot-remove-btn:hover {
    background-color: #da190b;
}

/* ========== 4-BAGGER COUNTER ========== */
.bagger-actions {
    flex-wrap: wrap;
    gap: 6px;
}

.bagger-counter {
    display: flex;
    align-items: center;
    gap: 0;
    background-color: #1a1a1a;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #555;
}

.bagger-minus-btn,
.bagger-plus-btn {
    padding: 5px 10px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 0;
    cursor: pointer;
    margin: 0;
    min-width: 32px;
    line-height: 1;
}

.bagger-minus-btn {
    background-color: #f44336;
    color: #fff;
}

.bagger-minus-btn:hover {
    background-color: #da190b;
}

.bagger-plus-btn {
    background-color: #4CAF50;
    color: #fff;
}

.bagger-plus-btn:hover {
    background-color: #45a049;
}

.bagger-count {
    padding: 5px 12px;
    font-size: 16px;
    font-weight: bold;
    color: #FFD700;
    background-color: #2c2c2c;
    min-width: 24px;
    text-align: center;
}

/* ========== ADA TOTAL ROW ========== */
.ada-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #555;
}

.ada-total-label {
    font-size: 14px;
    color: #aaa;
    font-weight: bold;
}

.ada-total-value {
    font-size: 18px;
    font-weight: bold;
    color: #64B5F6;
    flex: 1;
    text-align: right;
    margin-right: 8px;
}

.ada-reset-btn {
    background-color: #777;
    font-size: 11px;
    padding: 4px 10px;
}

.ada-reset-btn:hover {
    background-color: #555;
}

/* ========== OUTPUT / WHEEL ANIMATION ========== */
p[id^="output-"] {
    font-size: 1.5em;
    margin-top: 20px;
    height: 60px;
    overflow: hidden;
    position: relative;
    background-color: #222;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
}

/* The scanning line effect */
p[id^="output-"]::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background-color: rgba(255, 215, 0, 0.5);
    z-index: 10;
    pointer-events: none;
}

/* Scrolling list of names */
.wheel-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    top: 0;
    width: 100%;
}

/* Individual name in the wheel */
.wheel-item {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: bold;
    color: #888;
    transition: color 0.1s;
}

/* Highlight the center item */
.wheel-item.active {
    color: #fff;
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Winner reveal animation */
.winner {
    display: inline-block;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

@keyframes winnerReveal {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== COLLAPSIBLE LIST ========== */
.list-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    transition: color 0.2s;
}

.list-toggle:hover {
    color: #4CAF50;
}

.toggle-icon {
    font-size: 0.8em;
    width: 20px;
    text-align: center;
    display: inline-block;
    transition: transform 0.2s;
}

.participant-list {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out;
    max-height: 1000px;
    opacity: 1;
    overflow: hidden;
}

.participant-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* ========== MOBILE STYLES ========== */
@media (max-width: 1024px) {
    body {
        padding: 0;
        padding-top: 70px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 15px;
        padding: 0 10px;
    }

    .tab-bar {
        padding: 10px 8px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .sections-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .section {
        max-width: 100% !important;
        min-width: 100% !important;
        width: 100% !important;
        border-radius: 0;
        margin: 0 !important;
        padding: 20px;
        box-sizing: border-box;
    }

    /* Adjust input fields for mobile */
    .input-section input {
        width: 100%;
        margin: 5px 0;
        box-sizing: border-box;
    }

    .input-section button {
        width: 100%;
        margin: 10px 0 5px 0;
    }

    /* Adjust buttons for mobile */
    button {
        padding: 12px 15px;
        font-size: 16px;
        width: auto;
    }

    /* Smaller output text on mobile */
    p[id^="output-"] {
        font-size: 1.3em;
    }
}

/* Very small mobile devices */
@media (max-width: 480px) {
    .tab-bar {
        padding: 8px 4px;
        gap: 6px;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 13px;
    }

    h1 {
        font-size: 1.3em;
    }

    .section h2 {
        font-size: 1.3em;
    }

    .section {
        padding: 15px;
    }
}

/* Smooth scrolling for navigation */
html {
    scroll-behavior: smooth;
}

/* ========== DESKTOP FOCUS MODE ========== */
@media (min-width: 1025px) {
    #focus-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.85);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    #focus-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .section {
        transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease, opacity 0.3s ease;
        position: relative;
        z-index: 1;
    }

    /* When focus mode is active, dim non-focused sections */
    body.focus-active .section:not(.focused) {
        filter: blur(2px) grayscale(80%);
        pointer-events: none;
        opacity: 0.3;
    }

    .section.focused {
        z-index: 1001;
        transform: scale(1.05);
        box-shadow: 0 0 50px rgba(76, 175, 80, 0.3);
        cursor: default;
    }
}

/* Footer */
footer {
    margin-top: 30px;
    padding: 15px;
    color: #888;
    font-size: 13px;
}

/* Hide number input spinners (arrows) */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

/* ========== HISTORY STYLES ========== */
.history-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background-color: #2c2c2c;
    border: 1px solid #444;
    border-left: 4px solid #4CAF50;
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.history-item.cat-airmail {
    border-left-color: #4CAF50;
}

.history-item.cat-bagger {
    border-left-color: #FF9800;
}

.history-item.cat-dice {
    border-left-color: #2196F3;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-badge {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #444;
    color: #fff;
}

.history-badge.cat-airmail {
    background-color: #2e7d32;
}

.history-badge.cat-bagger {
    background-color: #ef6c00;
}

.history-badge.cat-dice {
    background-color: #1565c0;
}

.history-time {
    font-size: 12px;
    color: #aaa;
}

.history-text {
    color: #e0e0e0;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.3;
}

.history-empty {
    text-align: center;
    color: #888;
    padding: 25px 10px;
    font-style: italic;
}