/* ── Base ─────────────────────────────────────────────────── */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #0f2318;
    color: #e8e0d0;
    min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────── */
.page { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar { display: none; }  /* hide default Blazor sidebar for game pages */

main { flex: 1; display: flex; flex-direction: column; }
.top-row { display: none; }  /* hide default "About" link */
.content { padding-top: 0; }

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Game header ──────────────────────────────────────────── */
.game-header {
    background: #0a1a10;
    border-bottom: 1px solid #1e4028;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #9dbfa8;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}
.game-header .title { font-weight: 700; color: #c8e6c9; font-size: 1rem; }

/* ── Board chain ──────────────────────────────────────────── */
.board-chain-wrap {
    background: #0a2010;
    border: 1px solid #1e4028;
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
    overflow-x: auto;
    min-height: 56px;
    display: flex;
    align-items: center;
}
.board-chain {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
}
.board-empty-label {
    font-size: 0.8rem;
    color: #4a7055;
    white-space: nowrap;
}

/* ── Domino tile SVG ──────────────────────────────────────── */
.domino {
    display: block;
    overflow: visible;
}

/* Full size (hand, suggestion) — portrait */
.domino--full { width: 36px; height: 72px; }
/* Mini (opponent knowledge) — portrait */
.domino--mini { width: 24px; height: 48px; }
/* Board chain — portrait for doubles, landscape for regulars */
.domino--board { width: 36px; height: 72px; }
.domino--board.domino--landscape { width: 72px; height: 36px; }

/* Normal state */
.domino--normal .domino-body  { fill: #f5f0e0; stroke: #c8b878; stroke-width: 1.5; }
.domino--normal .domino-half  { fill: none; stroke: #d4c89a; stroke-width: 0.8; }
.domino--normal .domino-divider { stroke: #c8b878; stroke-width: 1.5; }
.domino--normal .domino-pip   { fill: #2a1a08; }

/* Legal — blue glow */
.domino--legal .domino-body  { fill: #ddeeff; stroke: #3b82f6; stroke-width: 2; }
.domino--legal .domino-half  { fill: none; stroke: #93c5fd; stroke-width: 0.8; }
.domino--legal .domino-divider { stroke: #3b82f6; stroke-width: 2; }
.domino--legal .domino-pip   { fill: #1e3a8a; }

/* Selected — gold */
.domino--selected .domino-body  { fill: #fffbea; stroke: #d97706; stroke-width: 2.5; }
.domino--selected .domino-half  { fill: none; stroke: #fbbf24; stroke-width: 0.8; }
.domino--selected .domino-divider { stroke: #d97706; stroke-width: 2.5; }
.domino--selected .domino-pip   { fill: #78350f; }

/* Illegal — faded */
.domino--illegal .domino-body  { fill: #3a3028; stroke: #5a4a38; stroke-width: 1; }
.domino--illegal .domino-half  { fill: none; stroke: #4a3a28; stroke-width: 0.8; }
.domino--illegal .domino-divider { stroke: #5a4a38; stroke-width: 1; }
.domino--illegal .domino-pip   { fill: #6a5a48; }

/* Played (opponent confirmed played) */
.domino--played .domino-body  { fill: #282828; stroke: #484848; stroke-width: 1; }
.domino--played .domino-half  { fill: none; stroke: #383838; stroke-width: 0.8; }
.domino--played .domino-divider { stroke: #484848; stroke-width: 1; }
.domino--played .domino-pip   { fill: #686868; }

/* Definite — green, brain knows this opponent holds it */
.domino--definite .domino-body  { fill: #d4edda; stroke: #28a745; stroke-width: 1.5; }
.domino--definite .domino-half  { fill: none; stroke: #5cb87a; stroke-width: 0.8; }
.domino--definite .domino-divider { stroke: #28a745; stroke-width: 1.5; }
.domino--definite .domino-pip   { fill: #155724; }

/* Possible — amber, brain thinks opponent might hold it */
.domino--possible .domino-body  { fill: #fff3cd; stroke: #ffc107; stroke-width: 1; }
.domino--possible .domino-half  { fill: none; stroke: #ffd54f; stroke-width: 0.8; }
.domino--possible .domino-divider { stroke: #ffc107; stroke-width: 1; }
.domino--possible .domino-pip   { fill: #856404; }

/* ── Tile button wrapper ───────────────────────────────────── */
.tile-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    border-radius: 10px;
    transition: transform 0.1s, box-shadow 0.1s;
}
.tile-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.tile-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.tile-btn.selected { box-shadow: 0 0 0 3px #d97706; border-radius: 10px; }

/* ── Tile grids ───────────────────────────────────────────── */
.tile-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tile-mini-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.knowledge-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6a9070;
    margin-bottom: 2px;
    margin-top: 6px;
}
.knowledge-label.definite { color: #5cb87a; }
.knowledge-label.possible { color: #d4a017; }

/* ── Player rows ──────────────────────────────────────────── */
.player-row {
    padding: 8px 10px;
    border-radius: 8px;
    background: #122518;
    border: 1px solid #1e4028;
    margin-bottom: 6px;
}
.player-row.active {
    background: #1a3a24;
    border-color: #3a7a50;
}
.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}
.player-name { font-weight: 700; color: #c8e6c9; }
.player-name.active { color: #4ade80; }
.player-stats { font-size: 0.8rem; color: #6a9070; }
.turn-indicator { color: #4ade80; font-size: 0.8rem; margin-left: 6px; }

/* ── Suggestion panel ─────────────────────────────────────── */
.suggestion-panel {
    background: #0d2518;
    border: 1px solid #3a7a50;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.suggestion-tile-wrap { flex-shrink: 0; }
.suggestion-text { flex: 1; }
.suggestion-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #4ade80; margin-bottom: 4px; }
.suggestion-reason { font-size: 0.85rem; color: #c8e6c9; line-height: 1.4; }
.suggestion-pass { color: #fbbf24; font-style: italic; }

/* ── Board section ────────────────────────────────────────── */
.section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a7055;
    margin-bottom: 6px;
    margin-top: 14px;
}

/* ── Action buttons ───────────────────────────────────────── */
.btn-primary {
    background: #1a6e3a;
    border-color: #2a9e54;
    color: #fff;
}
.btn-primary:hover { background: #2a8e4a; border-color: #3abe64; }

.btn-warning {
    background: #7a5a00;
    border-color: #a07800;
    color: #ffe0a0;
}
.btn-warning:hover { background: #9a7200; }

.btn-success {
    background: #1a6e3a;
    border-color: #2a9e54;
    color: #fff;
}

.btn-outline-secondary {
    color: #6a9070;
    border-color: #2a4a34;
    background: transparent;
}
.btn-outline-secondary:hover { background: #122518; color: #9dbfa8; }

.btn-danger {
    background: #7a1a1a;
    border-color: #a02a2a;
    color: #ffd0d0;
}

/* ── Misc ─────────────────────────────────────────────────── */
a, .btn-link { color: #4ade80; }

.alert-info    { background: #0d2518; border-color: #3a7a50; color: #c8e6c9; }
.alert-danger  { background: #2a0a0a; border-color: #7a1a1a; color: #ffd0d0; }
.alert-warning { background: #2a1a00; border-color: #7a5a00; color: #ffe0a0; }
.alert-success { background: #0d2518; border-color: #3a7a50; color: #c8e6c9; }

.text-muted { color: #6a9070 !important; }
.text-success { color: #4ade80 !important; }

.form-control, .form-select {
    background: #122518;
    border-color: #2a4a34;
    color: #c8e6c9;
}
.form-control:focus, .form-select:focus {
    background: #1a3a24;
    border-color: #3a7a50;
    color: #e8f5e9;
    box-shadow: 0 0 0 0.2rem rgba(74,222,128,0.2);
}
.form-label { color: #9dbfa8; font-size: 0.85rem; }
input::placeholder { color: #4a7055; }

h1, h2, h3, h4, h5, h6 { color: #c8e6c9; }

.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 0.1rem #0a1a10, 0 0 0 0.25rem #4ade80;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid #4ade80; }
.invalid { outline: 1px solid #f87171; }
.validation-message { color: #f87171; }

.blazor-error-boundary {
    background: #2a0a0a;
    padding: 1rem 1rem 1rem 3.7rem;
    color: #ffd0d0;
    border-radius: 8px;
}
.blazor-error-boundary::after { content: "An error has occurred." }

.btn-group .btn-outline-primary {
    color: #6a9070;
    border-color: #2a4a34;
}
.btn-group .btn-primary {
    background: #1a6e3a;
    border-color: #2a9e54;
    color: #fff;
}

/* ── New game / deal page ─────────────────────────────────── */
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #c8e6c9;
    margin-bottom: 4px;
}
.page-subtitle { font-size: 0.85rem; color: #6a9070; margin-bottom: 20px; }
