:root {
    --bg-color: #2c3e50;
    --sidebar-bg: #34495e;
    --text-color: #ecf0f1;
    --accent-color: #e67e22;
    --panel-bg: #2c3e50;
    --border-color: #7f8c8d;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--sidebar-bg);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #d35400;
}

#app {
    display: flex;
    height: 100%;
}

#sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#sidebar h1 {
    margin: 0 0 15px 0;
    font-size: 1.5em;
    text-align: center;
    color: var(--accent-color);
}

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#map-container {
    flex: 1;
    background-color: #95a5a6; /* Sea color default */
    overflow: hidden;
    position: relative;
    cursor: grab;
}

#map-container:active {
    cursor: grabbing;
}

#log-container {
    height: 150px;
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    padding: 10px;
    overflow-y: auto;
}

.panel {
    background-color: var(--panel-bg);
    padding: 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.panel h2 {
    margin: 0 0 8px 0;
    font-size: 1em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    color: var(--accent-color);
    cursor: pointer;
    user-select: none;
}

.panel h2:hover {
    color: #d35400;
}

.panel-content {
    margin-top: 8px;
}

.panel.collapsed .panel-content {
    display: none;
}

.panel h2::before {
    content: '▼ ';
    font-size: 0.7em;
    margin-right: 5px;
}

.panel.collapsed h2::before {
    content: '▶ ';
}

button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin: 0;
    transition: all 0.2s;
    font-size: 0.9em;
}

button:hover {
    background-color: #d35400;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

button:active {
    transform: translateY(0);
}

input, select {
    background-color: #ecf0f1;
    border: none;
    padding: 5px;
    border-radius: 3px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 0.9em;
}

#action-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.action-btn {
    text-align: left;
    padding: 8px 10px;
    font-size: 0.85em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.action-btn .action-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-btn .ap-cost-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    text-align: center;
    min-width: 45px;
}

.action-btn .ap-cost-badge.affordable {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 2px 4px rgba(46, 204, 113, 0.3);
}

.action-btn .ap-cost-badge.too-expensive {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.action-btn.action-selected {
    background-color: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.action-btn.action-selected .ap-cost-badge {
    background: rgba(255,255,255,0.3);
    color: white;
}

#game-log {
    font-family: monospace;
    font-size: 0.9em;
}

.log-entry {
    margin-bottom: 4px;
    border-bottom: 1px solid #465c71;
    padding-bottom: 2px;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none;
}

.modal-content {
    background-color: var(--sidebar-bg);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid var(--accent-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--accent-color);
}

.modal-content label {
    display: block;
    margin-top: 10px;
    margin-bottom: 3px;
    font-size: 0.9em;
    color: #bdc3c7;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    margin-bottom: 8px;
}

.modal-content button {
    margin-top: 10px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

/* Tooltip */
#tooltip {
    position: absolute;
    background-color: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #7f8c8d;
    pointer-events: none; /* Let mouse events pass through */
    font-size: 0.9em;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    max-width: 200px;
}

#tooltip h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    border-bottom: 1px solid #7f8c8d;
    padding-bottom: 2px;
}

#tooltip ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
}

/* Map Controls */
#map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(44, 62, 80, 0.9);
    padding: 8px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#map-controls button {
    width: 35px;
    height: 35px;
    font-size: 1.2em;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#zoom-level {
    text-align: center;
    font-size: 0.8em;
    color: var(--text-color);
    margin-top: 5px;
    padding: 2px;
}

#log-container h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: var(--accent-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

/* Test Panel Styles */
#test-panel {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { border-color: #e74c3c; }
    50% { border-color: #c0392b; }
}

kbd {
    background-color: #34495e;
    border: 1px solid #7f8c8d;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    box-shadow: 0 2px 0 #7f8c8d;
}

/* === Animations & Visual Feedback === */

@keyframes hexClick {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.action-btn.selected {
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px var(--accent-color);
}

.log-entry {
    animation: slideIn 0.3s ease-out;
}

.modal {
    animation: fadeIn 0.2s ease-out;
}

/* Tooltip improvements */
#tooltip {
    animation: fadeIn 0.15s ease-out;
    white-space: nowrap;
}

#tooltip.multiline {
    white-space: normal;
}

/* Button feedback */
button:active {
    transform: translateY(0) scale(0.95);
}

/* Panel transitions */
.panel-content {
    transition: all 0.3s ease-out;
    overflow: hidden;
}

.panel.collapsed .panel-content {
    max-height: 0;
    opacity: 0;
}

/* Success/Error messages */
.success-msg {
    color: #2ecc71;
    font-weight: bold;
    animation: slideIn 0.3s ease-out;
}

.error-msg {
    color: #e74c3c;
    font-weight: bold;
    animation: slideIn 0.3s ease-out;
}

/* Highlight selected action */
.action-btn:hover {
    background-color: #d35400;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* Loading indicator */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading::after {
    content: "⏳";
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 5px;
}

/* === Additional UI Improvements === */

/* Smooth Transitions for Start Screen */
#start-menu, #new-game-setup {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#start-menu.hiding {
    opacity: 0;
    transform: translateY(-20px);
}

#new-game-setup {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* Loading Spinner */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Improved Button States */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

button:not(:disabled):active {
    transform: translateY(1px) scale(0.98);
}

/* Better form inputs */
input[type="text"], input[type="number"], select {
    transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
    border-color: #e67e22;
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.2);
    outline: none;
}

/* Notification Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(46, 204, 113, 0.95);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    animation: toastSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 3000;
    max-width: 350px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s, opacity 0.3s;
}

.toast::before {
    content: '✓';
    display: inline-block;
    font-size: 1.3em;
    font-weight: bold;
}

.toast.error {
    background: rgba(231, 76, 60, 0.95);
}

.toast.error::before {
    content: '✕';
}

.toast.info {
    background: rgba(52, 152, 219, 0.95);
}

.toast.info::before {
    content: 'ℹ';
}

.toast.warning {
    background: rgba(243, 156, 18, 0.95);
}

.toast.warning::before {
    content: '⚠';
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Pulse animation for important events */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Glow animation for divine powers */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(155, 89, 182, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(155, 89, 182, 0.8), 0 0 30px rgba(155, 89, 182, 0.6);
    }
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Fade in animation for panels */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sparkle effect for level-ups */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }
}

/* ==========================================
   MULTIPLAYER STYLES
   ========================================== */

.turn-indicator {
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

.turn-indicator.my-turn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    animation: pulse-turn 1.5s infinite;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

.turn-indicator.waiting {
    background: rgba(255, 255, 255, 0.1);
    color: #bdc3c7;
}

@keyframes pulse-turn {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 30px rgba(46, 204, 113, 0.8);
    }
}

#mp-status-bar {
    transition: all 0.3s ease;
}

#mp-turn-display.my-turn {
    background: rgba(46, 204, 113, 0.5) !important;
    color: white;
    font-weight: bold;
}

#mp-turn-display.waiting {
    background: rgba(0, 0, 0, 0.2);
    color: #bdc3c7;
}

/* Lobby Styles */
#multiplayer-lobby ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#multiplayer-lobby li {
    padding: 8px 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Disabled state for non-turn actions */
.action-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Player indicator colors */
.player-p1 { border-left: 3px solid #e74c3c; }
.player-p2 { border-left: 3px solid #3498db; }
.player-p3 { border-left: 3px solid #2ecc71; }
.player-p4 { border-left: 3px solid #f1c40f; }

/* ==========================================
   MOBILE RESPONSIVE DESIGN
   ========================================== */

/* Tablet (< 1024px) */
@media screen and (max-width: 1024px) {
    #app {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        padding: 10px;
    }

    #main {
        flex: 1;
        min-height: 50vh;
    }

    #log-container {
        height: 100px;
    }

    .panel {
        padding: 6px;
    }

    .panel h2 {
        font-size: 0.9em;
    }

    #action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .action-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        font-size: 0.75em;
        padding: 6px 8px;
    }
}

/* Mobile (< 768px) */
@media screen and (max-width: 768px) {
    #sidebar {
        max-height: 35vh;
        padding: 8px;
        gap: 8px;
    }

    #sidebar h1 {
        font-size: 1.2em;
        margin-bottom: 8px;
    }

    .panel {
        padding: 5px;
    }

    .panel h2 {
        font-size: 0.85em;
        padding-bottom: 3px;
    }

    button {
        padding: 8px 12px;
        font-size: 0.85em;
        min-height: 40px; /* Touch-friendly */
    }

    .action-btn {
        flex: 1 1 100%;
        font-size: 0.8em;
        padding: 10px;
    }

    #map-controls {
        top: 5px;
        right: 5px;
        padding: 5px;
    }

    #map-controls button {
        width: 40px;
        height: 40px;
        font-size: 1.4em;
    }

    .modal-content {
        width: 95%;
        max-width: none;
        padding: 15px;
        max-height: 85vh;
    }

    #log-container {
        height: 80px;
    }

    #tooltip {
        max-width: 160px;
        font-size: 0.8em;
    }
}

/* Small Mobile (< 480px) */
@media screen and (max-width: 480px) {
    #sidebar {
        max-height: 30vh;
        padding: 5px;
    }

    #sidebar h1 {
        font-size: 1em;
    }

    .panel {
        margin-bottom: 4px;
    }

    /* Collapse all panels by default on small screens */
    .panel:not(.panel-essential) {
        /* Optional: auto-collapse */
    }

    button {
        min-height: 44px; /* iOS recommended touch target */
    }

    #log-container {
        height: 60px;
        padding: 5px;
    }

    #game-log {
        font-size: 0.8em;
    }
}

/* ==========================================
   BUTTON GROUPING & ORGANIZATION
   ========================================== */

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.button-group-label {
    width: 100%;
    font-size: 0.75em;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    padding-bottom: 2px;
    border-bottom: 1px dashed var(--border-color);
}

.button-group button {
    flex: 1 1 calc(50% - 4px);
    min-width: 80px;
    font-size: 0.8em;
    padding: 6px 8px;
}

.button-group.vertical {
    flex-direction: column;
}

.button-group.vertical button {
    flex: none;
    width: 100%;
}

/* ==========================================
   ACTION AFFORDABILITY INDICATORS
   ========================================== */

.action-btn.cannot-afford {
    opacity: 0.6;
    background-color: #5a6268;
    cursor: not-allowed;
}

.action-btn.cannot-afford:hover {
    background-color: #5a6268;
    transform: none;
    box-shadow: none;
}

.action-btn.bonus-available {
    background: linear-gradient(135deg, var(--accent-color), #9b59b6);
    border: 1px solid #9b59b6;
}

.action-btn.bonus-available::before {
    content: '★ ';
}

/* ==========================================
   IMPROVED MODALS
   ========================================== */

.modal {
    z-index: 1000; /* Ensure above everything */
}

.modal-content {
    position: relative;
}

.modal-content .close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    transition: all 0.2s;
}

.modal-content .close:hover {
    background: rgba(231, 76, 60, 0.8);
    color: white;
}

/* Confirmation Dialog Styles */
.confirm-dialog {
    text-align: center;
    padding: 20px;
}

.confirm-dialog h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.confirm-dialog .cost-warning {
    font-size: 1.5em;
    color: #f1c40f;
    margin: 15px 0;
}

.confirm-dialog .button-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.confirm-dialog .btn-cancel {
    background-color: #7f8c8d;
}

.confirm-dialog .btn-confirm {
    background-color: #27ae60;
}

/* ==========================================
   CURRENT TURN INDICATOR (Solo Mode)
   ========================================== */

.current-player-indicator {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2), rgba(39, 174, 96, 0.3));
    border: 2px solid #27ae60;
    border-radius: 5px;
    padding: 8px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: bold;
}

.current-player-indicator .player-name {
    font-size: 1.1em;
    color: #2ecc71;
}

.current-player-indicator .ap-display {
    font-size: 1.3em;
    color: #f1c40f;
    margin-top: 5px;
}

/* ==========================================
   IMPROVED PANEL ORGANIZATION
   ========================================== */

.panel-collapsible {
    transition: all 0.3s ease;
}

.panel-priority-high {
    order: -1;
}

.panel-priority-low {
    order: 1;
}

/* Divine Powers Sub-sections */
.divine-powers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.divine-powers-grid button {
    font-size: 0.75em;
    padding: 6px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media screen and (max-width: 768px) {
    .divine-powers-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   UX IMPROVEMENTS - DICE, AP BAR, FEEDBACK
   ========================================== */

/* Dice Roll Animation */
.dice-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin: 10px 0;
}

.dice-roll {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border-radius: 8px;
    font-size: 1.8em;
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.3), inset 1px 1px 2px rgba(255,255,255,0.8);
    animation: diceRoll 0.6s ease-out;
}

.dice-roll.rolling {
    animation: diceShake 0.1s infinite;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(0.5); opacity: 0; }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

@keyframes diceShake {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.dice-result-display {
    font-size: 1.2em;
    font-weight: bold;
}

.dice-result-display.success { color: #2ecc71; }
.dice-result-display.partial { color: #f1c40f; }
.dice-result-display.fail { color: #e74c3c; }

/* AP Progress Bar */
.ap-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

.ap-bar {
    flex: 1;
    height: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.ap-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f1c40f, #e67e22);
    border-radius: 10px;
    transition: width 0.3s ease-out;
    position: relative;
}

.ap-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
    border-radius: 10px 10px 0 0;
}

.ap-text {
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

.ap-change {
    animation: apChange 0.5s ease-out;
    color: #2ecc71;
    font-weight: bold;
}

.ap-change.negative {
    color: #e74c3c;
}

@keyframes apChange {
    0% { transform: translateY(-10px); opacity: 0; }
    50% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(5px); opacity: 0; }
}

/* Undo/Redo Buttons */
#undo-container {
    display: flex;
    gap: 5px;
}

.undo-btn, .redo-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.85em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.undo-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.redo-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.undo-btn:hover:not(:disabled), .redo-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.undo-btn:disabled, .redo-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.undo-btn:active:not(:disabled), .redo-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Action Selection Feedback */
.action-waiting {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(52, 152, 219, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    animation: waitingPulse 1.5s infinite;
    z-index: 2500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-waiting::before {
    content: '👆';
    font-size: 1.2em;
}

@keyframes waitingPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(52, 152, 219, 0.7); }
}

/* Enhanced Log Entries */
.log-entry {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 0.85em;
    border-left: 3px solid transparent;
    transition: background 0.2s;
}

.log-entry:hover {
    background: rgba(255,255,255,0.05);
}

.log-entry.log-action {
    border-left-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.log-entry.log-success {
    border-left-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.log-entry.log-warning {
    border-left-color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
}

.log-entry.log-error {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.log-entry.log-system {
    border-left-color: #9b59b6;
    color: #bdc3c7;
    font-style: italic;
}

.log-entry .log-icon {
    margin-right: 6px;
}

.log-entry .log-player {
    font-weight: bold;
}

.log-entry .log-entity {
    color: #3498db;
    cursor: pointer;
    text-decoration: underline;
}

.log-entry .log-entity:hover {
    color: #5dade2;
}

/* Hex Hover when action selected */
.hex-highlight-pulse {
    animation: hexPulse 1s infinite;
}

@keyframes hexPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}