:root {
    --primary: #4c6ef5;
    --secondary: #12b886;
    --danger: #fa5252;
    --warning: #fd7e14;
    --success: #40c057;
    --light: #f1f3f5;
    --dark: #343a40;
    --text: #212529;
    --bg: #f8f9fa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    padding: 20px;
    overflow-x: hidden;
}

h1, h2, h3 {
    margin-bottom: 15px;
    color: var(--primary);
    text-align: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .container {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.balance {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    background: var(--light);
    border-radius: 10px;
    border: 3px dashed var(--primary);
}

.time {
    text-align: center;
    font-size: 18px;
    margin-bottom: 10px;
}

.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
    margin-bottom: 20px;
    border: 2px solid var(--light);
    border-radius: 10px;
    overflow: hidden;
}

/* Chart styles */
.chart-line {
    fill: none;
    stroke-width: 2;
}

.chart-point {
    r: 4;
}

.chart-axis {
    stroke: var(--dark);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    text-align: left;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid var(--light);
}

th {
    background-color: var(--primary);
    color: white;
    position: sticky;
    top: 0;
}

tr:nth-child(even) {
    background-color: var(--light);
}

.stock-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.portfolio {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.trade-history {
    max-height: 200px;
    overflow-y: auto;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--light);
    cursor: pointer;
    transition: background-color 0.2s;
}

.stock-item:hover {
    background-color: var(--light);
}

.price-up {
    color: var(--success);
}

.price-down {
    color: var(--danger);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-size: 16px;
}

button:hover {
    transform: scale(1.05);
}

.btn-buy {
    background-color: var(--success);
    color: white;
}

.btn-sell {
    background-color: var(--danger);
    color: white;
}

.btn-short {
    background-color: var(--warning);
    color: white;
}

.btn-limit {
    background-color: var(--secondary);
    color: white;
}

.btn-adv {
    background-color: var(--primary);
    color: white;
}

.trade-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.trade-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: bold;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 16px;
}

.ai-trader {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: var(--light);
    border-radius: 10px;
    margin-bottom: 20px;
}

.ai-trader img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.ai-thought {
    font-style: italic;
    font-size: 14px;
    color: var(--dark);
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    display: none;
}

.game-over-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    max-width: 600px;
}

.game-over h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.game-over p {
    font-size: 20px;
    margin-bottom: 30px;
}

.btn-restart {
    background-color: var(--primary);
    color: white;
    padding: 15px 30px;
    font-size: 20px;
}

/* Margin information section */
.margin-info {
    background-color: var(--light);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

.margin-alert {
    color: var(--danger);
    font-weight: bold;
}