* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f5f7fa, #d7e1ec);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2933;
    height: 100vh;
}

#app {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 24px;
    padding: 12px;
}

#world {
    border: 2px solid #1f2933;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 24px rgba(31, 41, 51, 0.15);
    max-width: 100%;
    height: auto;
}

#left-panel {
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#status-bar {
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

#right-panel {
    width: 280px;
    display: flex;
    flex-direction: column;
}

#stats-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(31, 41, 51, 0.12);
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 15px;
    height: 250px;
}

#log-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(31, 41, 51, 0.12);
    height: 410px;
}

#stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 12px;
    font-size: 0.92rem;
    height: 100%;
}

#stats .label {
    font-weight: 600;
}

#stats .value {
    text-align: right;
}

.buttons {
    display: flex;
    gap: 8px;
}

button {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

button:not(:disabled):hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

#instructions {
    font-size: 0.9rem;
    color: #0f172a;
}

#gameStatus {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

@media (max-width: 1100px) {
    #app {
        justify-content: center;
    }

    #right-panel {
        width: 100%;
        max-width: 800px;
    }
}

@media (min-width: 1100px) {
    #app {
        height: 700px;
    }
}

#poisonRemaining {
    font-weight: bold;
    color: #2563eb;
}

#visual-debug-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
    height: 20px;
}

#visual-debug-row input {
    display: inline-block;
    cursor: pointer;
}

#visual-debug-row label {
    display: inline-block;
    font-weight: bold;
    cursor: pointer;
}

#history-log-label {
    font-weight: bold;
}

#history-log-list {
    height: 300px;
    overflow-y: auto;
    padding-right: 5px;
    margin-top: 10px;
}

.history-entry {
    border-bottom: 1px solid #eee;
    padding: 8px 0;
    font-size: 0.85rem;
}

.entry-header {
    font-weight: bold;
    margin-bottom: 4px;
    color: #2563eb;
}

.entry-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #555;
    font-size: 0.8rem;
}

.entry-details span {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

#history-log-list p {
    font-weight: bold;
}