/* Desktop Layout - Default */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0f4c3a;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(34, 139, 34, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 69, 19, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #0f4c3a 100%);
    color: #f5f5dc;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

h1, h2 {
    text-align: center;
    color: #daa520;
    border-bottom: 2px solid rgba(218, 165, 32, 0.4);
    padding-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    font-weight: 600;
    letter-spacing: 1px;
}

.suit-row {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 2px;
}

.card-button {
    padding: 6px 4px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #8b4513;
    background: linear-gradient(145deg, #f5f5dc, #e6e6fa);
    border-radius: 6px;
    transition: all 0.3s ease;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    aspect-ratio: 5 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 55px;
    max-height: 55px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card-button:hover {
    background: linear-gradient(145deg, #fff8dc, #f0e68c);
    box-shadow: 0 4px 12px rgba(218, 165, 32, 0.4);
    transform: translateY(-2px);
}

.card-button.selected {
    background: linear-gradient(145deg, #6b6b6b, #505050) !important;
    color: #333 !important;
    border-color: #555 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    opacity: 0.5;
}

.card-button.selected:hover {
    background: linear-gradient(145deg, #7b7b7b, #606060) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    opacity: 0.6;
}

/* Dead cards when dead mode is OFF - look like selected cards (gray) */
.card-button.dead {
    background: linear-gradient(145deg, #6b6b6b, #505050) !important;
    color: #333 !important;
    border-color: #555 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    opacity: 0.5;
}

.card-button.dead:hover {
    background: linear-gradient(145deg, #7b7b7b, #606060) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    opacity: 0.6;
}

/* Dead cards when dead mode is ON - show in purple */
.dead-mode-active .card-button.dead {
    background: linear-gradient(145deg, #9370db, #8a2be2) !important;
    color: #fff !important;
    border-color: #6a0dad !important;
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.4) !important;
    opacity: 0.7;
    cursor: pointer !important;
}

.dead-mode-active .card-button.dead:hover {
    background: linear-gradient(145deg, #a487e8, #9b4dff) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.6) !important;
    opacity: 0.9;
}

.card-button.disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    border-color: #ccc;
}

.spades { 
    color: #000000; 
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.hearts { 
    color: #dc143c; 
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.diamonds { 
    color: #dc143c; 
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.clubs { 
    color: #000000; 
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* ==================== ADVISOR MODE LAYOUTS ==================== */

/* Desktop Advisor Layout */
#advisor .game-state-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

#advisor .game-state {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.5), rgba(160, 82, 45, 0.4));
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 15px;
    align-items: stretch;
    justify-content: flex-start;
    border: 2px solid rgba(218, 165, 32, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    max-height: none;
}

/* Reduce size when dead cards box is not visible - fit to row 1 only */
#advisor .game-state:not(.has-dead-cards) {
    min-height: 0;
    height: fit-content;
}

/* When dead cards are visible, allow container to grow */
#advisor .game-state.has-dead-cards {
    min-height: auto;
}

/* Desktop: game-state-row-1 flows in one row, game-state-row-2 is separate */
#advisor .game-state-row-1 {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 30px;
    align-items: center;
    justify-content: flex-start;
    min-height: 120px;
    max-height: 120px;
}

#advisor .game-state-row-2 {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 0 0 auto;
}

#advisor .dead-cards-display-section {
    flex: 1;
    min-width: 550px; /* Minimum width to fit 8 cards with scrolling if needed */
    max-width: 850px; /* Maximum width to fit 12 cards */
    overflow: visible;
    box-sizing: border-box;
}

#advisor .dead-cards-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    box-sizing: border-box;
}

#advisor .dead-cards-section .button-spacer {
    visibility: hidden;
    margin: 0;
    height: 20px;
    margin-bottom: 5px;
    padding-bottom: 0;
}

.dead-cards-toggle-inline {
    position: static;
    padding: 10px 20px;
    font-size: 14px;
    margin: 0;
    margin-left: 0;
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

#advisor .hand-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 120px;
    min-height: 120px;
    max-height: 120px;
    justify-content: flex-start;
    box-sizing: border-box;
}

#advisor .player-hand-section {
    min-width: 150px; /* 2 cards width: 2 * 38px + 12px gap + 30px padding = ~100px */
    max-width: 150px;
    width: 150px;
}

#advisor .community-cards-section {
    flex: 1;
    min-width: 300px; /* 5 cards width: 5 * 38px + 4 * 12px gap + 30px padding = ~220px */
    max-width: 350px;
    overflow-x: auto; /* Allow horizontal scrolling if more than 5 cards */
    overflow-y: hidden;
}

/* Desktop Card Selector */
#advisor #card-selector-container {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.4), rgba(160, 82, 45, 0.3));
    border-radius: 12px;
    border: 2px solid rgba(218, 165, 32, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#advisor .card-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
}

#advisor .suit-row {
    gap: 3px;
}

#advisor .card-button {
    padding: 8px 4px;
    min-height: 50px;
    max-height: 50px;
}

#advisor .hand-display {
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    padding: 15px;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.6), rgba(139, 69, 19, 0.3));
    border: 2px solid rgba(218, 165, 32, 0.4);
    border-radius: 8px;
    margin-top: 5px;
    font-size: 1.3em;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: nowrap; /* Prevent wrapping to maintain card alignment */
    justify-content: flex-start; /* Align cards to the left */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    width: 100%;
    box-sizing: border-box;
}

#advisor .hand-display .card {
    padding: 8px 4px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #ccc;
    background-color: #ffffff;
    border-radius: 6px;
    text-align: center;
    font-family: Helvetica, Arial, sans-serif;
    aspect-ratio: 5 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    width: 38px;
    flex-shrink: 0; /* Prevent cards from shrinking */
}

#advisor .hand-display .card.removable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

#advisor .hand-display .card.removable:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
    border-color: #dc143c;
}

#advisor .hand-display .card.removable::after {
    content: '×';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #dc143c, #ff6347);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

#advisor .hand-display .card.removable:hover::after {
    display: flex;
}

/* Community cards specific styling for overflow handling */
#advisor .community-cards-section .hand-display {
    min-width: 220px; /* Ensure minimum width for 5 cards */
    justify-content: flex-start; /* Always align to left */
}

/* Dead cards display specific styling for overflow handling */
#advisor .dead-cards-display-section .hand-display {
    min-width: 100%; /* Use full available width */
    overflow-x: auto; /* Enable horizontal scrolling for many cards */
    overflow-y: hidden;
    justify-content: flex-start; /* Always align to left */
}

.hand-section h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1em;
    border: none;
    padding-bottom: 0;
    text-align: left;
    color: #daa520;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    height: 20px;
    line-height: 20px;
}

.hand-display {
    min-height: 80px;
    padding: 15px;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.6), rgba(139, 69, 19, 0.3));
    border: 2px solid rgba(218, 165, 32, 0.4);
    border-radius: 8px;
    margin-top: 5px;
    font-size: 1.3em;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hand-display .card {
    padding: 6px 4px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #ccc;
    background-color: #ffffff;
    border-radius: 6px;
    text-align: center;
    font-family: Helvetica, Arial, sans-serif;
    aspect-ratio: 5 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    width: 40px;
}

.hand-display .card.removable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.hand-display .card.removable:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
    border-color: #dc143c;
}

.hand-display .card.removable::after {
    content: '×';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #dc143c, #ff6347);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.hand-display .card.removable:hover::after {
    display: flex;
}

.controls, .results {
    text-align: center;
    padding: 25px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    margin: 15px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.results {
    flex-direction: column;
    align-items: stretch;
}

.controls label {
    margin-right: 5px;
    color: #daa520;
    font-weight: bold;
}

.controls select {
    margin-right: 15px;
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    background: linear-gradient(145deg, #daa520, #ffd700);
    color: #000;
    border: 2px solid #b8860b;
    border-radius: 8px;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s ease;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(218, 165, 32, 0.5);
}

.btn:disabled {
    background-color: rgba(255, 215, 0, 0.3);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
}

/* Grey styling for reset button */
#reset-btn {
    background: linear-gradient(145deg, #6c757d, #5a6268);
    color: #f8f9fa;
    border: 2px solid #495057;
}

#reset-btn:hover {
    background: linear-gradient(145deg, #5a6268, #495057);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(108, 117, 125, 0.5);
}

.btn:active:not(.toggle-btn),
.btn:focus:not(.toggle-btn) {
    outline: none;
}

.btn.toggle-btn {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.6), rgba(160, 82, 45, 0.4));
    border: 2px solid rgba(218, 165, 32, 0.3);
    color: #f5f5dc;
    transition: none;
    transform: none;
    box-shadow: none;
}

.btn.toggle-btn:hover,
.btn.toggle-btn:focus,
.btn.toggle-btn:active {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.6), rgba(160, 82, 45, 0.4));
    border: 2px solid rgba(218, 165, 32, 0.3);
    color: #f5f5dc;
    transform: none;
    box-shadow: none;
    outline: none;
}

.btn.toggle-btn.active {
    background: linear-gradient(145deg, #9370db, #8a2be2);
    border-color: #6a0dad;
    color: #fff;
    box-shadow: none;
    transform: none;
}

.btn.toggle-btn.active:hover,
.btn.toggle-btn.active:focus,
.btn.toggle-btn.active:active {
    background: linear-gradient(145deg, #9370db, #8a2be2);
    border-color: #6a0dad;
    color: #fff;
    box-shadow: none;
    transform: none;
    outline: none;
}

.toggle-icon {
    font-size: 1.2em;
    display: inline-block;
    margin-right: 5px;
}

#results-display {
    margin-top: 6px;
    font-size: 1.2em;
    line-height: 1.6;
    color: #ffffff;
    width: 100%;
}

.result-section {
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border-left: 3px solid rgba(218, 165, 32, 0.5);
    width: 100%;
    box-sizing: border-box;
}

.result-section-title {
    font-weight: bold;
    color: #daa520;
    margin-bottom: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-line {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.result-line span:first-child {
    font-weight: bold;
    color: #ffd700;
}

.result-line span.positive {
    color: #90ee90;
    font-weight: bold;
}

.result-line span.negative {
    color: #ff6b6b;
    font-weight: bold;
}

.result-line-small {
    font-size: 0.75em;
    padding: 2px 8px;
}

.optimal-action {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(145deg, #daa520, #ffd700);
    color: #000;
    font-size: 1.4em;
    font-weight: bold;
    border-radius: 8px;
    border: 2px solid #b8860b;
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.4);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

label {
    margin-right: 10px;
    color: #f5f5dc;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

input[type="number"] {
    width: 100px;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffffff;
    border-radius: 4px;
    font-size: 16px;
}

input[type="number"]:focus {
    outline: none;
    border-color: #daa520;
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 10px rgba(218, 165, 32, 0.3);
}

/* Table Profile Selector */
.table-select {
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffffff;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    min-width: 100px;
    margin-right: 15px;
}

.table-select:focus {
    outline: none;
    border-color: #daa520;
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 10px rgba(218, 165, 32, 0.3);
}

.table-select option {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 8px;
}

/* Table Info Display */
.table-info {
    margin: 15px 0;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.table-info h3 {
    margin: 0 0 10px 0;
    color: #daa520;
    font-size: 18px;
}

/* Row 1: Table Limits, Game Parameters, Payout Multipliers (40% 20% 40%) */
.table-info-row-1 {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.table-limits-column {
    flex: 2;
    min-width: 0;
}

.game-params-column {
    flex: 1;
    min-width: 0;
}

.payout-column {
    flex: 2;
    min-width: 0;
}

/* 2-column grid for parameters within each column */
.table-info-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

/* 1-column grid for game parameters (narrower column) */
.table-info-grid-1col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

/* Row 2: Strategy Matrix (full width) */
.table-info-row-2 {
    margin-top: 15px;
    padding-top: 15px;
}

.strategy-column-full {
    width: 100%;
}

.strategy-column {
    flex: 1;
    min-width: 0;
}

/* Payout table styling */
.payout-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    margin: 0;
    background: transparent;
    border: 1px solid #daa520;
    border-radius: 6px;
    overflow: hidden;
}

.payout-table th {
    padding: 5px 6px;
    text-align: center;
    background: #00000033;
    border-bottom: 2px solid #daa520;
    font-weight: 600;
    color: #daa520;
    font-size: 11px;
}

.payout-table td {
    padding: 4px 6px;
    background: transparent !important;
    color: #fff !important;
    transition: none !important;
    transform: none !important;
    cursor: default;
    box-shadow: none !important;
    border-bottom: 1px solid rgba(218, 165, 32, 0.2);
}

.payout-table td.hand-name {
    text-align: left;
    font-size: 11px;
}

.payout-table td.payout-value {
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    background: #0f4c3a !important;
}

.payout-table tr:last-child td {
    border-bottom: none;
}

/* Strategy column styling */
.strategy-column .strategy-matrix {
    margin: 0;
}

.strategy-legend {
    margin-top: 10px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.strategy-legend span {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.legend-bet4x {
    background: linear-gradient(145deg, #228b22, #32cd32);
}

.legend-bet3x {
    background: linear-gradient(145deg, #ff8c00, #ffa500);
}

.legend-check {
    background: linear-gradient(145deg, #5a6a7a, #708090);
}

.legend-suited {
    background: linear-gradient(145deg, #4169e1, #6495ed);
}

.strategy-probability {
    font-size: 0.9em;
}

.strategy-probability strong,
.strategy-probability span {
    color: #daa520;
}

.strategy-probability span {
    font-weight: bold;
}

/* Legacy grid for fallback */
.table-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.table-param {
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border-left: 3px solid #daa520;
}

.table-param-label {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-param-value {
    font-size: 14px;
    color: #fff;
    font-weight: bold;
    margin-top: 2px;
}

/* ==================== POKER-THEMED ADDITIONS ==================== */

/* General table styles - exclude strategy matrix and table-info tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.6), rgba(160, 82, 45, 0.4));
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(218, 165, 32, 0.4);
}

/* Override for strategy matrix tables */
.strategy-matrix table {
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
}

/* Override for table-info tables */
.table-info table {
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 10px 0;
    border-radius: 0;
}

/* General table cell styles */
th, td {
    padding: 6px 4px;
    text-align: center;
    border: 1px solid rgba(218, 165, 32, 0.3);
    font-weight: bold;
    font-size: 14px;
}

th {
    background: linear-gradient(145deg, #8b4513, #a0522d);
    color: #f5f5dc;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    font-size: 16px;
    padding: 15px 8px;
}

td {
    background: rgba(245, 245, 220, 0.9);
    color: #000;
    transition: all 0.2s ease;
    padding: 6px 4px;
}

td:hover {
    background: rgba(255, 248, 220, 0.95);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Strategy Matrix Decision Colors */
td.bet {
    background: linear-gradient(145deg, #228b22, #32cd32) !important;
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

td.bet3x {
    background: linear-gradient(145deg, #ff8c00, #ffa500) !important;
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

td.check {
    background: linear-gradient(145deg, #5a6a7a, #708090) !important;
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

td.suited {
    background: linear-gradient(145deg, #4169e1, #6495ed) !important;
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(218, 165, 32, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    margin: 15px 0;
    padding: 2px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #daa520, #ffd700);
    border-radius: 8px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

/* Mode Selector Buttons */
.mode-btn {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.6), rgba(160, 82, 45, 0.4));
    border: 2px solid rgba(218, 165, 32, 0.3);
    color: #f5f5dc;
    padding: 15px;
    margin: 5px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.mode-btn:hover {
    background: linear-gradient(145deg, rgba(160, 82, 45, 0.7), rgba(139, 69, 19, 0.5));
    border-color: rgba(218, 165, 32, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(218, 165, 32, 0.3);
}

.mode-btn.active {
    background: linear-gradient(145deg, #daa520, #ffd700);
    color: #000;
    border-color: #b8860b;
    box-shadow: 0 6px 15px rgba(218, 165, 32, 0.5);
}

/* Content Areas */
.mode-content {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.4), rgba(160, 82, 45, 0.3));
    border: 2px solid rgba(218, 165, 32, 0.3);
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Results Sections */
.results-section {
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.5), rgba(139, 69, 19, 0.3));
    border: 2px solid rgba(218, 165, 32, 0.4);
    border-radius: 10px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Status Messages */
.status-message {
    background: linear-gradient(145deg, rgba(218, 165, 32, 0.8), rgba(255, 215, 0, 0.6));
    color: #000;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #b8860b;
    margin: 10px 0;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(218, 165, 32, 0.3);
}

/* Input Fields */
input[type="text"], select {
    background: rgba(245, 245, 220, 0.9);
    border: 2px solid #8b4513;
    border-radius: 6px;
    padding: 8px 12px;
    color: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #daa520;
    box-shadow: 0 0 10px rgba(218, 165, 32, 0.4);
    background: rgba(255, 248, 220, 0.95);
}

/* Download Buttons */
.download-btn {
    background: linear-gradient(145deg, #4169e1, #6495ed);
    color: #fff;
    border: 2px solid #0000cd;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s ease;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.download-btn:hover {
    background: linear-gradient(145deg, #6495ed, #87ceeb);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(65, 105, 225, 0.4);
}


#strategy-progress {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.4), rgba(160, 82, 45, 0.3));
    border: 2px solid rgba(218, 165, 32, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#strategy-status {
    margin-top: 15px;
    padding: 10px;
    font-size: 16px;
    color: #f5f5dc;
    text-align: center;
}

#strategy-result {
    margin-top: 10px;
    padding: 10px;
}

#strategy-result h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    text-align: center;
}

.strategy-matrix {
    margin: 15px 0;
    padding: 5px;
    margin-left: auto;
    margin-right: auto;
}

.strategy-matrix table {
    margin: 0 auto;
    width: 100%;
    max-width: 400px;
    border-collapse: separate;
    border-spacing: 0;
}

.strategy-matrix th,
.strategy-matrix td {
    box-sizing: border-box;
    padding: 3px;
    width: 25px;
    height: 25px;
    max-width: 25px;
    min-width: 25px;
    max-height: 25px;
    min-height: 25px;
    font-size: 11px;
    line-height: 1;
    text-align: center;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.strategy-matrix th {
    background: linear-gradient(145deg, #e0e0e0, #f0f0f0);
    color: #1a73e8;
    font-weight: bold;
    text-shadow: none;
}

.strategy-matrix td.clickable {
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.strategy-matrix td.clickable:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(100, 100, 100, 0.6);
    z-index: 10;
    position: relative;
}

/* Legend styling */
#strategy-result div[style*="margin-top: 20px"] {
    margin-top: 25px !important;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(218, 165, 32, 0.2);
}

#strategy-result div[style*="margin-top: 20px"] strong {
    display: block;
    margin-bottom: 15px;
    font-size: 16px;
    color: #daa520;
}

#strategy-result div[style*="margin-top: 20px"] span {
    display: inline-block;
    margin: 5px 10px 5px 0;
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
}

/* Download buttons section */
#strategy-result .controls[style*="margin-top: 20px"] {
    margin-top: 25px !important;
    padding: 25px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(218, 165, 32, 0.2);
}

/* ==================== MOBILE LAYOUT - iPhone 16 Pro Max Optimized ==================== */
@media (max-width: 770px) {
    /* Mobile Body */
    body {
        padding: 3px;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Mobile Advisor Layout */
    #advisor .game-state-wrapper {
        gap: 8px;
        margin-bottom: 3px;
    }
    
    #advisor .game-state {
        padding: 5px;
        flex-direction: column; /* Stack rows vertically in mobile */
        gap: 8px;
        height: auto;
        min-height: auto;
        max-height: none;
        align-items: stretch;
    }
    
    /* Mobile: game-state-row wrappers become visible flex containers */
    #advisor .game-state-row {
        display: flex;
        flex-direction: row;
        gap: 4px;
        height: 80px;
        min-height: 80px;
        max-height: 80px;
        align-items: center;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    /* Second row should be full width for dead cards */
    #advisor .game-state-row-2 {
        width: 100%;
        min-width: 100%;
    }
    
    /* Reduce game state size when dead cards box is hidden in mobile */
    #advisor .game-state:not(.has-dead-cards) {
        padding: 4px;
        gap: 4px;
        height: 78px; /* Fit only one row: 70px row + 4px padding top + 4px padding bottom */
        min-height: 78px;
        max-height: 78px;
    }
    
    /* Hide second row when dead cards are hidden */
    #advisor .game-state:not(.has-dead-cards) .game-state-row-2 {
        display: none;
    }
    
    #advisor .game-state:not(.has-dead-cards) .game-state-row-1 {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }
    
    #advisor .game-state:not(.has-dead-cards) .hand-section {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }
    
    #advisor .game-state:not(.has-dead-cards) .hand-display {
        height: 60px;
        min-height: 60px;
        max-height: 60px;
        padding: 4px;
    }
    
    #advisor .game-state:not(.has-dead-cards) .hand-display .card {
        min-height: 30px;
        max-height: 30px;
        width: 24px;
        max-width: 24px;
        font-size: 12px;
        padding: 3px 1px;
    }
    
    #advisor .game-state:not(.has-dead-cards) .dead-cards-section {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }
    
    #advisor .game-state:not(.has-dead-cards) .dead-cards-toggle-inline {
        height: 60px;
        min-height: 60px;
        max-height: 60px;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }
    
    /* Dead cards row can be taller for 2 lines only when there are more than 8 cards */
    #advisor .game-state-row:has(.dead-cards-display-section.many-dead-cards) {
        height: auto;
        min-height: 80px;
        max-height: 160px;
    }
    
    #advisor .dead-cards-display-section {
        flex: 1;
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    #advisor .dead-cards-display-section .hand-display {
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        margin-top: 0;
        flex-wrap: nowrap; /* Default: no wrapping */
        max-height: 70px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    /* Only wrap when there are many dead cards (more than 8) */
    #advisor .dead-cards-display-section.many-dead-cards .hand-display {
        flex-wrap: wrap; /* Allow cards to wrap to 2 lines */
        max-height: 150px; /* Allow 2 rows of cards */
        overflow-x: hidden;
        overflow-y: auto; /* Scroll if needed */
    }
    
    #advisor .dead-cards-display-section h3 {
        display: none;
    }
    
    #advisor .dead-cards-section {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 70px;
        min-width: 70px;
        max-width: 70px;
        box-sizing: border-box;
        margin-left: 4px;
    }
    
    #advisor .dead-cards-section .button-spacer {
        display: none;
    }
    
    .dead-cards-toggle-inline {
        padding: 0;
        font-size: 20px;
        height: 70px;
        width: 70px;
        min-height: 70px;
        max-height: 70px;
        min-width: 70px;
        max-width: 70px;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .dead-cards-toggle-inline .toggle-text {
        display: none;
    }
    
    .dead-cards-toggle-inline .toggle-icon {
        margin-right: 0;
    }
    
    #advisor .hand-section {
        flex: 0 0 auto;
        align-items: center;
        height: 80px;
        justify-content: center;
    }
    
    #advisor .player-hand-section {
        min-width: 100px; /* Slightly wider for mobile */
        max-width: 100px;
        width: 100px;
    }
    
    #advisor .community-cards-section {
        flex: 1;
        min-width: 0;
        max-width: none;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    #advisor .hand-display {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
        padding: 6px;
        gap: 4px;
        font-size: 1.0em;
        justify-content: flex-start; /* Align cards to left */
        flex-wrap: nowrap; /* Prevent wrapping */
        overflow-x: auto; /* Allow horizontal scrolling if needed */
    }
    
    #advisor .hand-display .card {
        padding: 4px 2px;
        font-size: 14px;
        min-height: 35px;
        max-height: 35px;
        width: 28px;
        max-width: 28px;
        flex-shrink: 0; /* Prevent cards from shrinking */
    }
    
    /* Mobile removable card styling */
    #advisor .hand-display .card.removable::after {
        top: -6px;
        right: -6px;
        width: 16px;
        height: 16px;
        font-size: 12px;
    }
    
    #advisor .hand-display .card.removable:active::after {
        display: flex;
    }
    
    #advisor .hand-display .card.removable:hover {
        transform: translateY(-2px);
    }
    
    /* Player hand specific styling for mobile */
    #advisor .player-hand-section .hand-display {
        justify-content: center; /* Center player cards */
        width: 100%;
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }
    
    /* Community cards specific styling for mobile */
    #advisor .community-cards-section .hand-display {
        justify-content: flex-start; /* Align community cards to left */
        width: 100%;
        height: 70px;
        min-height: 70px;
        max-height: 70px;
        overflow-x: auto;
    }
    
    /* Dead cards display specific styling for mobile */
    #advisor .dead-cards-display-section .hand-display {
        justify-content: flex-start; /* Align dead cards to left */
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: 70px;
        min-height: 70px;
        max-height: 70px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px;
        gap: 4px;
        flex-wrap: nowrap; /* Default: no wrapping */
    }
    
    /* Only wrap when there are many dead cards (more than 8) */
    #advisor .dead-cards-display-section.many-dead-cards .hand-display {
        height: auto;
        min-height: 70px;
        max-height: 150px; /* Allow 2 rows of cards */
        overflow-x: hidden;
        overflow-y: auto;
        flex-wrap: wrap; /* Allow cards to wrap to 2 lines */
    }
    
    /* Mobile Card Selector */
    #advisor #card-selector-container {
        margin-top: 3px;
        margin-bottom: 3px;
        padding: 10px;
    }
    
    #advisor .card-selector {
        gap: 1px;
        margin-bottom: 12px;
    }
    
    #advisor .suit-row {
        gap: 1px;
    }
    
    #advisor .card-button {
        padding: 4px 2px;
        font-size: 14px;
        min-height: 40px;
        max-height: 40px;
        border-radius: 4px;
    }
    
    /* Mobile Controls - 2x6 Grid Layout */
    #advisor .controls {
        padding: 12px;
        margin: 10px 0;
        display: grid;
        grid-template-columns: 35px 1.5fr 30px 1fr 50px 50px;
        grid-template-rows: auto;
        row-gap: 4px;
        column-gap: 5px;
        align-items: center;
        box-sizing: border-box;
        overflow: hidden;
        width: 100%;
        max-width: 430px;
    }
    
    #advisor .controls label {
        font-size: 8px !important;
        margin: 0 !important;
        padding: 0 2px 0 0 !important;
        text-align: left;
        color: #daa520;
        white-space: nowrap;
        display: block;
    }
    
    #advisor .controls label[for="table-profile"] {
        grid-column: 1;
        grid-row: 1;
    }
    
    #advisor .controls select#table-profile {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 32px;
        padding: 2px 4px !important;
        font-size: 9px !important;
        box-sizing: border-box;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #advisor .controls label[for="mode-select"] {
        grid-column: 3;
        grid-row: 1;
    }
    
    #advisor .controls select#mode-select {
        grid-column: 4;
        grid-row: 1;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 32px;
        padding: 2px 4px !important;
        font-size: 9px !important;
        box-sizing: border-box;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #advisor .btn {
        white-space: nowrap;
        min-height: 44px; /* Better tap target */
        font-weight: 600;
    }
    
    #advisor .btn:active:not(.toggle-btn),
    #advisor .btn:focus:not(.toggle-btn) {
        outline: none;
    }
    
    #advisor .controls button#calculate-btn {
        grid-column: 5;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        padding: 2px 3px;
        width: 100%;
        min-width: 0;
        max-width: 60px;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        line-height: 1.2;
    }
    
    #advisor .controls button#reset-btn {
        grid-column: 6;
        grid-row: 1;
        background: linear-gradient(145deg, #808080, #666666);
        border-color: #555;
        color: #f5f5dc;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        padding: 2px 3px;
        width: 100%;
        min-width: 0;
        max-width: 55px;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        line-height: 1.2;
    }
    
    #advisor .controls button#reset-btn:hover {
        background: linear-gradient(145deg, #909090, #707070);
    }
    
    #advisor .controls button#reset-btn:active,
    #advisor .controls button#reset-btn:focus {
        background: linear-gradient(145deg, #808080, #666666);
        outline: none;
    }
    
    /* Mobile dead card styling */
    #advisor .card-button.dead {
        opacity: 0.6;
    }
    
    #advisor .card-button.dead:active {
        opacity: 0.7;
    }
    
    #advisor .dead-mode-active .card-button.dead {
        opacity: 0.8;
    }
    
    #advisor .dead-mode-active .card-button.dead:active {
        opacity: 1;
    }
    
    /* Ensure input field doesn't take too much space */
    #advisor input[type="number"] {
        width: 80px;
        margin: 0 10px;
        flex: 0 0 auto;
    }
    
    /* Mobile Results - Improved */
    #advisor .results {
        padding: 8px;
        margin: 8px 0;
    }
    
    #advisor #results-display {
        font-size: 15px;
        line-height: 1.6;
    }
    
    #advisor #results-display .results-section {
        padding: 8px !important;
        margin-bottom: 8px !important;
    }
    
    #advisor #results-display .ev-item {
        padding: 8px !important;
        font-size: 14px !important;
    }
    
    #advisor #results-display .result-line {
        font-size: 15px !important;
        padding: 10px 8px !important;
    }
    
    #advisor #results-display .result-line-small {
        font-size: 11px !important;
        padding: 2px 8px !important;
    }
    
    #advisor #results-display .optimal-action {
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    /* Table Info Mobile */
    #advisor .table-info {
        padding: 10px !important;
        margin: 10px 0 !important;
    }
    
    #advisor .table-info h3 {
        font-size: 13px !important;
        margin-bottom: 8px !important;
        display: block !important;
    }
    
    /* Mobile: Stack rows vertically */
    .table-info-row-1,
    .table-info-row-2 {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .table-limits-column,
    .game-params-column,
    .payout-column,
    .strategy-column,
    .strategy-column-full {
        width: 100% !important;
        flex: none !important;
    }
    
    .table-info-grid-2col {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    
    .table-info-grid-1col {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    
    #advisor .table-info-grid {
        gap: 8px !important;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    }
    
    #advisor .table-param {
        padding: 6px !important;
        background-color: rgba(0, 0, 0, 0.2);
    }
    
    #advisor .table-param-label {
        font-size: 9px !important;
    }
    
    #advisor .table-param-value {
        font-size: 12px !important;
    }
    
    /* Mobile payout table */
    .payout-table {
        font-size: 10px !important;
    }
    
    .payout-table th {
        font-size: 9px !important;
        padding: 4px !important;
    }
    
    .payout-table td {
        padding: 3px 4px !important;
    }
    
    .payout-table td.hand-name {
        font-size: 9px !important;
    }
    
    .payout-table td.payout-value {
        font-size: 11px !important;
    }
    
    /* Mobile strategy legend */
    .strategy-legend span {
        font-size: 8px !important;
        padding: 2px 4px !important;
    }
    
    .strategy-probability {
        font-size: 0.9em !important;
        padding: 5px !important;
    }
    
    .strategy-probability strong,
    .strategy-probability span {
        font-size: 0.9em !important;
    }
    
    /* Mobile table overrides for table-info tables */
    #advisor .table-info table {
        margin: 10px 0 !important;
        font-size: 11px !important;
    }
    
    #advisor .table-info table th,
    #advisor .table-info table td {
        padding: 4px 6px !important;
        font-size: 11px !important;
    }
    
    #advisor .table-info table th {
        padding: 5px 6px !important;
        font-size: 11px !important;
    }
    
    /* Show shortened title in mobile mode */
    h1 {
        font-size: 20px !important;
        padding-bottom: 5px !important;
        margin-bottom: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Hide the full title text and show shortened version */
    .header-row h1 {
        font-size: 0 !important; /* Hide original text */
    }
    
    .header-row h1::before {
        content: "🃏 Poker Solver";
        font-size: 20px !important;
        display: block;
    }
    
    /* Hide section headers in mobile */
    #advisor .game-state h3 {
        display: none !important;
    }
    
    /* Settings button container - right aligned */
    .tabs-container {
        gap: 6px !important;
        margin-bottom: 10px !important;
        justify-content: flex-end !important;
    }
    
    /* Hide "Settings" text in mobile, keep icon only */
    .settings-btn span:last-child {
        display: none !important;
    }
    
    /* Ensure all settings buttons (Training and Menu) have same size in mobile */
    .settings-btn,
    #user-menu-btn,
    a.settings-btn[href="training.html"] {
        padding: 8px !important;
        min-height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        height: 36px !important;
        width: 36px !important;
        border-radius: 6px !important;
        font-size: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        box-sizing: border-box !important;
    }
    
    .settings-btn span:first-child,
    #user-menu-icon {
        font-size: 18px !important;
        line-height: 1 !important;
        filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Strategy Matrix Mobile Styles - Full Width */
    #strategy-result h3 {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .strategy-matrix {
        padding: 0 !important;
        margin: 10px 0 !important;
        width: 100% !important;
        overflow-x: auto;
    }
    
    .strategy-matrix table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed;
    }
    
    .strategy-matrix th,
    .strategy-matrix td {
        width: calc(100% / 14) !important;
        height: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        max-height: none !important;
        min-height: 20px !important;
        padding: 4px 2px !important;
        font-size: 9px !important;
        aspect-ratio: 1 / 1;
    }
    
    /* Legend mobile styles */
    #strategy-result div[style*="margin-top: 20px"] {
        margin-top: 12px !important;
        padding: 10px !important;
    }
    
    #strategy-result div[style*="margin-top: 20px"] strong {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }
    
    #strategy-result div[style*="margin-top: 20px"] span {
        display: inline-block !important;
        padding: 3px 6px !important;
        font-size: 9px !important;
        margin-right: 4px !important;
        margin-bottom: 4px !important;
    }
    
    /* Progress bar mobile */
    #strategy-progress p {
        font-size: 11px !important;
    }
}
