body {
    background-color: rgb(0, 0, 0);
}
/* Rack area (question tiles) */
#rack-tiles {
    min-height: 60px;
}
/* Input tiles (answer area) - no black background */
#input-tiles {
    min-height: 84px; /* Increased to accommodate larger tiles */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}
.question-tile {
    width: 52px;
    height: 52px;
    min-height: 52px;
    margin: 2px;
    object-fit: contain;
    background: #fff;
    border-radius: 3px;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.answer-tile {
    width: 52px;
    height: 52px;
    min-height: 52px;
    margin: 0;
    object-fit: contain;
    background: #fff;
    border-radius: 3px;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.answer-tile-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 52px;
    height: 52px;
    min-height: 52px;
    margin: 2px;
    border: 1px solid #6d4c2a;
    background-color: #3d2b1a;
    border-radius: 3px;
    /* Always visible even when empty */
    visibility: visible;
    flex-shrink: 0;
}
.answer-tile-placeholder .answer-tile {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
}
.answer-tile.fixed {
    opacity: 0.7; /* Visually distinguish fixed tiles */
    pointer-events: none; /* Prevent dragging fixed tiles */
}
.nohooks {
    color: red; /* Words or hooks with no hooks */
}
.no_s_hook {
    color: blue; /* Words or hooks without -S hook */
}
.submission-log {
    max-height: 300px;
    overflow-y: auto;
}
.submission-log table {
    width: 100%;
    border-collapse: collapse;
}
.submission-log th, .submission-log td {
    border: 1px solid #495057;
    padding: 5px;
    text-align: center;
}
.submission-log .table-dark {
    background-color: #212529;
}
.submission-log .table-dark thead th {
    border-color: #495057;
}
.submission-log .table-dark tbody td {
    border-color: #495057;
}
.submission-log td[data-value="0"], .submission-log td[data-value="null"] {
    color: transparent;
}
#feedback.duplicate {
    color: #ffffff !important;
    font-weight: bold;
}
.correct { color: green !important; }
.correct-with-hints { color: rgb(126, 83, 3) !important; }
.incorrect { color: red !important; }
tr.incorrect td { color: red !important; }
tr.correct td { color: #FFB74D !important; }
tr.correct-with-hints td { color: #FFB74D !important; }
#last-entry-area {
    text-align: center;
}
.alphabox {
    background-color: #000000;
    font-family: monospace;
    color: white;
    font-weight: bold;
    margin: 20px;
    padding: 20px;
}
.alphaheadline {
    font-family: monospace;
    color: white;
    font-size: 2.5em;
    font-weight: bolder;
    margin-bottom: 20px;
}
.deffield {
    font-family: monospace;
    color: white;
    font-weight: bold;
    font-size: medium;
    margin-bottom: 10px;
}
/* hookfield – layout-only containers for hooks/similar words/backwords.
   Colour comes from inner .ab-word (amber) and .ab-def (grey) spans. */
.hookfield, .hookfield2, .hookfield3, .hookfield4 {
    margin-bottom: 6px;
    text-align: left;
}
.hookfield2 { padding-left: 20px; }
.hookfield3 { padding-left: 40px; }
.hookfield4 { padding-left: 60px; }

/* alphabox inner spans – amber/gold for words & hooks, grey for definitions */
.ab-word {
    color: #FFB74D;
    font-weight: bold;
}
.ab-def {
    color: #aaa;
    font-size: 0.85em;
}
.ab-label {
    color: #888;
    font-size: 0.85em;
    font-weight: bold;
}
.ab-reveal-btn {
    background: transparent;
    border: 1px solid #6d4c2a;
    color: #FFB74D;
    border-radius: 3px;
    font-size: 0.85em;
    line-height: 1;
    padding: 0 5px;
    margin-left: 2px;
    cursor: pointer;
}
.ab-reveal-btn:hover {
    background: #3d2b1a;
}
.extrabox {
    font-family: monospace;
    color: white;
    font-weight: bold;
    font-size: large;
    margin-bottom: 20px;
    margin-top: 20px;
}
#last-entry-area .accordion {
    text-align: left;
}
#last-entry-area .accordion-body {
    background-color: #000000;
    padding: 10px;
}
#last-entry-area .accordion-button {
    background-color: #000000;
    font-family: monospace;
    font-size: large;
    font-weight: bold;
    color: white;
}
#last-entry-area .accordion-button:not(.collapsed) {
    background-color: #000000;
    color: white;
}
/* FSRS plus button: matches game log style */
.fsrs-plus-wrap {
    display: inline;
    font-size: inherit;
    line-height: inherit;
}
.fsrs-plus-btn {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    padding: 0;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    font-weight: bold;
    font-family: inherit;
    color: #fff;
    background-color: #2E7D32;
    border: 1px solid #1B5E20;
    border-radius: 3px;
    cursor: pointer;
    box-sizing: border-box;
}
.fsrs-minus-indicator {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    padding: 0;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    font-weight: bold;
    font-family: inherit;
    color: #fff;
    background-color: #0D47A1;
    border: 1px solid #08306B;
    border-radius: 3px;
    box-sizing: border-box;
    cursor: pointer;
}
.fsrs-minus-indicator:hover {
    background-color: #0B3A85;
}
/* === Action Button – reusable dark button for game UIs === */
.action-btn {
    background: #333; color: #aaa; border: 1px solid #555; border-radius: 4px;
    padding: 4px 14px; font-size: 12px; cursor: pointer; transition: background 0.15s;
}
.action-btn:hover { background: #555; color: #fff; }

/* === Brown/Wood Panel Theme === */
/* Reusable brown-themed panel matching the endgame analysis cards */
.panel_cantik {
    background: #302418;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 12px;
}
.panel_cantik_header {
    font-size: 13px;
    font-weight: bold;
    color: #FFB74D;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Brown Table – reusable table class matching the endgame move-list look === */
/* Wrap inside a .panel_cantik for the full card appearance.                       */
/*   <div class="panel_cantik"><table class="table_cantik">...</table></div>       */
/*                                                                                */
/* Column widths shrink-to-fit by default. Use the predefined .col-* classes     */
/* on BOTH <th> and <td> for each column you need. Omit any you don't use.       */
/*                                                                                */
/* Predefined columns:                                                            */
/*   .col-date     – "Date"   – fits YYMMDD HH:MM                                */
/*   .col-pos      – "Pos"    – fits e.g. A15                                    */
/*   .col-player   – "Player" – auto-width for name, won't stretch               */
/*   .col-score    – "Score"  – fits 3-digit + sign, bold                         */
/*   .col-num      – "#"      – narrow row-number                                 */
/*   .col-move     – "Move"   – the main content column, takes remaining space    */
/*   .col-total    – "Total"  – cumulative score, right-aligned                   */
/*   .col-icon     – (no hdr) – tiny icon column                                  */
/*   .col-symbol   – (no hdr) – status symbol after turn # (skull etc.)           */
.table_cantik {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 0;
    table-layout: auto;
}

/* ---- Header ---- */
.table_cantik thead tr {
    border-bottom: 1px solid #555;
}
.table_cantik th {
    padding: 4px 8px;
    color: #FFB74D !important;
    font-weight: bold;
    font-size: 12px;
    white-space: nowrap;
    text-align: left;
}

/* ---- Body ---- */
.table_cantik tbody tr {
    border-bottom: 1px solid #3d2b1a;
}
.table_cantik tbody tr.player-b {
    background: #3d2b1a;
}
.table_cantik tbody tr:hover {
    background: #444 !important;
}
.table_cantik td {
    padding: 3px 8px;
    white-space: nowrap;
    font-size: 12px;
    color: #ccc;
}

/* ================================================================
   PREDEFINED COLUMNS – use on both <th> and <td>
   ================================================================ */

/* --- .col-date  "Date" – YYMMDD HH:MM --- */
.table_cantik .col-date {
    width: 1%;          /* shrink-to-fit */
    white-space: nowrap;
    color: #888;
    font-variant-numeric: tabular-nums;
    font-family: monospace, Arial, sans-serif;
    font-size: 11px;
    padding: 3px 6px;
}

/* --- .col-pos  "Pos" – e.g. A15, 8H --- */
.table_cantik .col-pos {
    width: 1%;
    white-space: nowrap;
    color: #888;
    font-variant-numeric: tabular-nums;
    font-family: monospace, Arial, sans-serif;
    font-size: 11px;
    padding: 3px 6px;
    text-align: left;
}

/* --- .col-player  "Player" – auto-width for name --- */
.table_cantik .col-player {
    width: 1%;          /* shrink-to-fit, won't stretch */
    white-space: nowrap;
    color: #ccc;
    font-size: 12px;
    padding: 3px 6px;
}

/* --- .col-score  "Score" – 3-digit score, bold --- */
.table_cantik .col-score {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-weight: bold;
    color: #ccc;
    font-variant-numeric: tabular-nums;
    font-family: monospace, Arial, sans-serif;
    font-size: 12px;
    padding: 3px 6px;
}

/* --- .col-num  "#" – narrow row counter --- */
.table_cantik .col-num {
    width: 1%;
    white-space: nowrap;
    color: #888;
    font-variant-numeric: tabular-nums;
    font-family: monospace, Arial, sans-serif;
    font-size: 11px;
    padding: 3px 6px;
    text-align: right;
}

/* --- .col-move  "Move" – main content, takes remaining space --- */
.table_cantik .col-move {
    width: auto;
    color: #ccc;
}

/* --- .col-total  "Total" – cumulative score, right-aligned --- */
.table_cantik .col-total {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-weight: bold;
    color: #fff;
    font-variant-numeric: tabular-nums;
    font-family: monospace, Arial, sans-serif;
    font-size: 12px;
    padding: 3px 6px;
}

/* --- .col-icon  icon slot (star, phony marker etc.) --- */
.table_cantik .col-icon {
    width: 18px;
    min-width: 18px;
    text-align: center;
    padding: 3px 2px;
}

/* --- .col-symbol  status symbol column (after turn #) --- */
.table_cantik .col-symbol {
    width: 1%;
    min-width: 16px;
    white-space: nowrap;
    text-align: center;
    font-size: 12px;
    padding: 3px 2px;
}

/* --- .col-hooks  front/back hooks column (X+ / +X) --- */
.table_cantik .col-hooks {
    width: 1%;
    white-space: nowrap;
    text-align: center;
    font-family: 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: #ccc;
    padding: 3px 2px;
}

/* ---- Anagram log overrides ---- */
.anagram-log th {
    text-align: center !important;
}
.anagram-log .col-move {
    width: 100%;
}
.anagram-log .col-move .tile-word {
    display: inline-flex;
    gap: 1px;
    align-items: center;
    vertical-align: middle;
    margin: 0 3px;
}
.anagram-log .col-move .tile-word img {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    background: #fff;
    border-radius: 2px;
}
.anagram-log .col-move .tile-word.tile-invalid img {
    background: #d32f2f;
}
.anagram-log .col-move .tile-hook {
    width: 13px;
    height: 13px;
    vertical-align: middle;
    background: #fff;
    border-radius: 2px;
    margin: 0 0.5px;
    opacity: 0.7;
}

/* ================================================================
   GENERIC MODIFIERS – combine with any column
   ================================================================ */
.table_cantik .col-right {
    text-align: right;
}
.table_cantik .col-center {
    text-align: center;
}
.table_cantik .col-bold {
    font-weight: bold;
}
.table_cantik .col-dim {
    color: #bbb;
}
.table_cantik .col-accent {
    color: #FFB74D;
}

/* Score colouring utilities – apply to <tr> to highlight the whole row */
.table_cantik .score-bingo {
    color: #FF9800 !important;
    font-weight: bold;
}
.table_cantik tr.bingo-row .col-pos,
.table_cantik tr.bingo-row .col-move,
.table_cantik tr.bingo-row .col-score {
    color: #FFB74D !important;
    font-weight: bold;
}
.table_cantik .score-invalid {
    color: #ff4757 !important;
    font-weight: bold;
}

/* Current / active row highlight */
.table_cantik .row-active td,
.table_cantik .row-current td {
    background: #4a3520;
}
.table_cantik .row-active td:hover,
.table_cantik .row-current td:hover {
    background: #444;
}

/* Endgame-style summary row */
.table_cantik .row-summary td {
    text-align: center;
    font-weight: bold;
    color: #FFB74D;
    padding: 8px;
}

/* ================================================================
   UNIFIED SCRABBLE BOARD
   Shared board class for consistent look across all pages:
   boardview.php, pre_endgame.php, first_move.php, etc.
   ================================================================ */

/* Board table – sits inside a .panel_cantik wrapper */
.scrabble-board {
    border-collapse: collapse;
    border-spacing: 0;
    border: 0;
    line-height: 0;
    /* Default desktop size: 567px (37.8px * 15) */
    width: 567px;
    height: 567px;
}
.scrabble-board td {
    padding: 0 !important;
    margin: 0 !important;
    border: 0;
    line-height: 0;
    vertical-align: top;
}
.scrabble-board tr,
.scrabble-board tbody tr {
    margin: 0;
    padding: 0;
    line-height: 0;
    height: 37.8px;
}
.scrabble-board tbody tr td {
    line-height: 0;
    height: 37.8px;
    padding: 0;
    margin: 0;
}

/* Board cells */
.scrabble-board .board-cell {
    width: 37.8px;
    height: 37.8px;
    border: 1px solid #555;
    background: #1a1a1a;
    display: block;
    position: relative;
    margin: 0;
    padding: 0;
    cursor: pointer;
    float: left;
    line-height: 0;
    box-sizing: border-box;
}

/* Premium squares */
.scrabble-board .board-cell.star          { background: #8B4513; }
.scrabble-board .board-cell.double-word   { background: #FF6B6B; }
.scrabble-board .board-cell.double-letter { background: #4ECDC4; }
.scrabble-board .board-cell.triple-word   { background: #FF4757; }
.scrabble-board .board-cell.triple-letter { background: #5352ED; }

/* Tile images inside cells */
.scrabble-board .board-tile {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
}
.scrabble-board .board-tile.blank-tile {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
.scrabble-board .board-tile.placed {
    cursor: pointer;
}

/* Most-recent-move highlight: amber/gold standard */
.scrabble-board .board-cell.last-move-highlight {
    background: #FFB74D !important;
}
.scrabble-board .board-cell.last-move-highlight .board-tile {
    background: #FFB74D !important;
}

/* Preview tiles (ranked move hover) */
.scrabble-board .board-cell.preview-tile {
    background: rgba(78, 205, 196, 0.3) !important;
    border: 2px solid #4ECDC4 !important;
}

/* Mobile responsive: board fills viewport width */
@media (max-width: 1200px) {
    .scrabble-board {
        width: calc(100vw - 40px) !important;
        height: calc(100vw - 40px) !important;
    }
    .scrabble-board .board-cell {
        width: calc((100vw - 40px) / 15) !important;
        height: calc((100vw - 40px) / 15) !important;
    }
    .scrabble-board tr,
    .scrabble-board tbody tr,
    .scrabble-board tbody tr td {
        height: calc((100vw - 40px) / 15) !important;
    }
}

/* ================================================================
   WORD_LIST – Reusable alphabox-inspired word list styling.
   All-caps words in amber/yellow, hooks (+X) and plus sign also
   amber/yellow, headlines small grey bold.
   ================================================================ */
.word_list {
    font-family: monospace, Arial, sans-serif;
    color: #ccc;
    font-size: 12px;
    line-height: 1.6;
}
.word_list .wl-word {
    color: #FFB74D;
    font-weight: bold;
    text-transform: uppercase;
}
.word_list .wl-hook {
    color: #FFB74D;
    font-weight: bold;
    text-transform: uppercase;
}
.word_list .wl-headline {
    color: #888;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    margin-bottom: 1px;
}
.word_list .wl-prob {
    color: #888;
    font-size: 10px;
}
.word_list .wl-def {
    color: #aaa;
    font-size: 11px;
    font-style: italic;
}

/* ================================================================
   WORD_POPUP – Mouseover popup for played tiles on any scrabble-board
   Uses word_list styling inside. Shows: words, probability,
   optional definition, optional hooks.
   Two-word mode uses side-by-side columns.
   ================================================================ */
.word_popup {
    position: absolute;
    background: #1a1a1a;
    color: #ccc;
    border: 1px solid #FFB74D;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.5;
    z-index: 2000;
    display: none;
    pointer-events: none;
    max-width: 520px;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    font-family: monospace, Arial, sans-serif;
}
/* Two-column container for 2-word popups */
.word_popup .wordpop-columns {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.word_popup .wordpop-col {
    flex: 1;
    min-width: 0;
}
/* Vertical divider between columns */
.word_popup .wordpop-col + .wordpop-col {
    border-left: 1px solid #444;
    padding-left: 16px;
}
.word_popup .wordpop-word {
    font-weight: bold;
    color: #FFB74D;
    font-size: 14px;
    margin-bottom: 2px;
    text-transform: uppercase;
}
.word_popup .wordpop-prob {
    color: #888;
    font-size: 10px;
    margin-bottom: 2px;
}
.word_popup .wordpop-def {
    color: #aaa;
    font-size: 11px;
    margin-bottom: 8px;
    font-style: italic;
}
.word_popup .wordpop-hooks-label {
    color: #888;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 1px;
}
.word_popup .wordpop-hook {
    color: #FFB74D;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    line-height: 1.6;
}
.word_popup .wordpop-divider {
    border-top: 1px solid #444;
    margin: 6px 0;
}

.form-group {
    margin-bottom: 1rem;
}
.form-label {
    color: white !important;
    font-family: monospace;
    font-weight: bold;
}
.form-control, .form-select {
    background-color: #333 !important;
    color: white !important;
    border: 1px solid #808080;
}
.form-check-input {
    background-color: #333;
    border: 1px solid #808080;
}
.form-check-label {
    color: white !important;
    font-family: monospace;
}
#optionsAccordion {
    background-color: #1a1a1a; /* Slightly lighter than black for contrast */
}
#optionsAccordion .accordion-item {
    background-color: #1a1a1a;
    color: white;
}
#optionsAccordion .accordion-button {
    background-color: #1a1a1a;
    color: white;
}
#optionsAccordion .accordion-button:not(.collapsed) {
    background-color: #333;
    color: white;
}