/* ---------- Global ---------- */
html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
}

input[type="radio"] {
    cursor: pointer;
}

/* ---------- Table Rows ---------- */
tbody tr {
    transition: all 0.2s ease;
}

tbody tr:nth-of-type(even) { background-color: #fafafa; }
tbody tr:nth-of-type(odd) { background-color: #fff; }

tbody tr:hover td,
table:not(#betTableDisplay) tbody tr:hover td:has(input[type="radio"]) {
    background-color: #dceeff;
}

.duplicate-row td {
    background-color: #ffd6d6 !important;
    color: #000 !important;
}

/* ---------- Table Radios ---------- */
table:not(#betTableDisplay) td:has(input[type="radio"]) { background-color: #e9f2ff; }
table:not(#betTableDisplay) td:nth-child(even):has(input[type="radio"]) { background-color: #d7e6ff; }

/* ---------- Bet Tables ---------- */
#betTableDisplay table {
    width: 750px;
    max-width: 100%;
    margin: 20px auto;
    table-layout: fixed;
    font-size: 13px;
    overflow: hidden;
}

#betTableDisplay td:nth-child(even) { background-color: #d7e6ff; }
#betTableDisplay td:nth-child(odd) { background-color: #eef5ff; }

/* ---------- Compact View ---------- */
#compactView {
    display: block;
    width: 100%;
    margin: 0 auto 20px;
    padding: 2px;
    border-collapse: separate;
    border-spacing: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

#compactView table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#compactView th,
#compactView td {
    padding: 4px 6px;
    font-size: 14px;
    vertical-align: middle;
    text-align: center;
    border: none;
}

#compactView th {
    background-color: #cde6ff;
    font-weight: 600;
    border-bottom: 1px solid #b0d4ff;
}

#compactView tbody tr:hover td { background-color: #dceeff; }

/* ---------- Buttons ---------- */
button[onclick^="tenBetPirate"],
#compactView button[onclick^="tenBetPirate"],
.tenBetButton {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 2px 8px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

button[onclick^="tenBetPirate"]:hover,
#compactView button[onclick^="tenBetPirate"]:hover,
.tenBetButton:hover {
    background-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

button[onclick^="tenBetPirate"]:active,
#compactView button[onclick^="tenBetPirate"]:active,
.tenBetButton:active {
    background-color: #004080;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

/* ---------- Table Wrappers ---------- */
.table-wrapper {
    margin: 0 auto;
    width: 60vw;
    overflow-x: auto;
}

.table-wrapper table {
    margin: 10px auto;
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.table-wrapper th,
.table-wrapper td {
    padding: 6px 8px;
    font-size: 15px;
    white-space: normal;
    text-align: center;
}

.table-wrapper input[type="radio"] { vertical-align: middle; }

/* ---------- Table Columns ---------- */
table:not(#betTableDisplay) {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
}

table:not(#betTableDisplay) th,
table:not(#betTableDisplay) td {
    border: 1px solid #ccc;
    text-align: center;
    padding: 2px 3px;
    overflow: hidden;
    white-space: wrap;
}

table:not(#betTableDisplay) th:nth-child(1),
table:not(#betTableDisplay) td:nth-child(1) { width: 8%; }
table:not(#betTableDisplay) th:nth-child(2),
table:not(#betTableDisplay) td:nth-child(2) { width: 4%; }
table:not(#betTableDisplay) th:nth-child(3),
table:not(#betTableDisplay) td:nth-child(3) { width: 15%; }
table:not(#betTableDisplay) th:nth-child(4),
table:not(#betTableDisplay) td:nth-child(4) { width: 6%; }
table:not(#betTableDisplay) th:nth-child(5),
table:not(#betTableDisplay) td:nth-child(5) { width: 6%; }
table:not(#betTableDisplay) th:nth-child(6),
table:not(#betTableDisplay) td:nth-child(6) { width: 6%; }
table:not(#betTableDisplay) th:nth-child(n+7):nth-child(-n+16),
table:not(#betTableDisplay) td:nth-child(n+7):nth-child(-n+16) { width: 3.5%; }
table:not(#betTableDisplay) th:nth-child(17),
table:not(#betTableDisplay) td:nth-child(17) { width: 6%; }

/* ---------- Table Headers ---------- */
th {
    background: linear-gradient(135deg, #e0f0ff, #c0dfff);
    color: #111;
    font-weight: 600;
    font-size: 15px;
    white-space: pre-wrap;
}

/* ---------- Links ---------- */
#links {
    width: fit-content;
    margin: 0 auto;
}

#links a {
    color: #0056b3;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s ease;
}


#links a:hover { color: #003d80; text-decoration: underline; }
#links a:visited { color: #003060; }

/* ---------- Top Right Buttons ---------- */
#topRightButtons {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    z-index: 999;
}

#topRightButtons button,
#darkModeToggle {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

#topRightButtons button:hover,
#darkModeToggle:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
#topRightButtons button:active,
#darkModeToggle:active { box-shadow: inset 0 1px 2px rgba(0,0,0,0.2); }

/* ---------- Direct Link ---------- */
.direct-link {
    text-align: center;
    width: 100%;
    margin: 20px 0;
}

.direct-link input {
    width: 300px;
}

body.dark-mode .direct-link input {
    background-color: #2b2b2b;
    color: #eee;
    border: 1px solid #555;
}


.copy-wrapper {
    display: inline-block;
    position: relative;
    width: 50%;
}

.copy-wrapper input { width: 100%; }

.copy-wrapper #copyMessage {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(15px, -50%);
    color: green;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* ---------- Dark Mode ---------- */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode table {
    background-color: #1b1b1b;
    color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border-color: #444;
}

body.dark-mode th {
    background: linear-gradient(135deg, #2b3a50, #1b2b44);
    color: #e0e0e0;
}

body.dark-mode tbody tr:nth-of-type(even) { background-color: #222; }
body.dark-mode tbody tr:nth-of-type(odd) { background-color: #1a1a1a; }
body.dark-mode tbody tr:hover td,
body.dark-mode table:not(#betDisplayTable) tbody tr:hover td:has(input[type="radio"]) {
    background-color: #334466 !important;
}

body.dark-mode .duplicate-row td {
    background-color: #5a1a1a !important;
    color: #f88 !important;
}

body.dark-mode table:not(#betDisplayTable) td:has(input[type="radio"]) { background-color: #2a3e55; }
body.dark-mode table:not(#betDisplayTable) td:nth-child(even):has(input[type="radio"]) { background-color: #223246; }

body.dark-mode #topRightButtons button,
body.dark-mode #darkModeToggle {
    background-color: #2b2b2b;
    color: #eee;
    border: 1px solid #555;
}

body.dark-mode #topRightButtons button:hover,
body.dark-mode #darkModeToggle:hover {
    background-color: #383838;
    border-color: #666;
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

body.dark-mode #links a { color: #99ccff; }
body.dark-mode #links a:hover { color: #cce0ff; }
body.dark-mode #links a:visited { color: #77aadd; }

body.dark-mode #betTableDisplay table {
    background-color: #1b1b1b;
    color: #e0e0e0;
    border-collapse: collapse;
    table-layout: fixed;
}

body.dark-mode #betTableDisplay th {
    background: linear-gradient(135deg, #2b3a50, #1b2b44);
    color: #e0e0e0;
}

body.dark-mode #betTableDisplay td:nth-child(even) { background-color: #223246; }
body.dark-mode #betTableDisplay td:nth-child(odd) { background-color: #1a1a1a; }

body.dark-mode #betTableDisplay tbody tr:hover td {
    background-color: #334466 !important;
}

/* ---------- Media Queries ---------- */
@media (max-width: 650px) {
    /* Table Wrapper */
    .table-wrapper,
    .table-wrapper table {
        width: 100%;
    }

    .table-wrapper th,
    .table-wrapper td {
        font-size: 0.6em;
        padding: 4px 6px;
    }

    /* Buttons */
    button[onclick^="tenBetPirate"] {
        padding: 1px;
        font-size: 10px;
    }

    /* Radio buttons in normal tables */
    table:not(#compactView) input[type="radio"] {
        transform: scale(0.7);
        margin-left: -3px;
        margin-right: auto;
        vertical-align: middle;
        display: block;
    }

    /* Compact View Table */
    #compactView {
        width: 100vw;
        margin: 0 auto;
        padding: 0;
    }

    #compactView table {
        width: 100vw;
        table-layout: auto;
        border-collapse: collapse;
        font-size: 10px;
    }

    #compactView th,
    #compactView td {
        font-size: 10px;
        padding: 0px 0px;
        text-align: center;
        vertical-align: top;
        white-space: normal;
    }

    #compactView button[onclick^="tenBetPirate"],
    .tenBetButton {
        font-size: 8px;
        padding: 2px 4px;
        border-radius: 4px;
    }

    .tenBetButton:hover {
        background-color: #0056b3;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .tenBetButton:active {
        background-color: #004080;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    }
    
    #compactView input[type="radio"] {
    transform: scale(0.6);
    margin: 0 auto;
    display: block;
}
    
    #compactViewToggle {
      display:none;
    }
}

