:root {
    --bg-color: #1a1a1a;
    --panel-bg: #2a2a2a;
    --border-color: #4a4a4a;
    --text-color: #e0e0e0;
    --header-color: #5f9ea0;
    --button-bg: #3a3a3a;
    --button-hover-bg: #4a4a4a;
    --accent-green: #4caf50;
    --accent-red: #f44336;
    --accent-blue: #2196f3;
    --accent-yellow: #ffeb3b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1400px;
    display: grid;
    grid-template-areas:
        "header"
        "main"
        "footer-main"
        "footer-info";
    grid-template-rows: auto 1fr auto auto; /* header, main (flexible), footer, footer-info */
    gap: 20px;
}

header { grid-area: header; }
main { grid-area: main; }
footer { grid-area: footer-main; }

.footer-info {
    grid-area: footer-info;
    text-align: center;
    padding: 10px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 20px;
}

.footer-info a {
    color: var(--header-color);
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

header h1 {
    text-align: center;
    color: var(--header-color);
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.panel h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--header-color);
    padding-bottom: 10px;
    color: var(--header-color);
}

main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}


#summary-panel {
    text-align: center;
}

#summary-content {
    font-size: 1.1rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

#stats-table {
    width: 100%;
    border-collapse: collapse;
}

#stats-table th, #stats-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

#stats-table thead {
    color: var(--header-color);
}

.dice-face {
    font-size: 1.5rem;
}

#distribution-graph {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 250px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    position: relative;
}

.bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 15%;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 40px;
    min-height: 2px;
    background-color: var(--accent-blue);
    transition: height 0.3s ease-in-out;
    border-radius: 4px 4px 0 0;
    flex-shrink: 0;
    order: 1;
}

.bar-label {
    margin-top: 10px;
    font-size: 1rem;
    flex-shrink: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2;
}

#fairness-content {
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
}

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

#dice-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

button {
    padding: 12px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
    background-color: var(--button-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--button-hover-bg);
}

#reset-btn {
    background-color: var(--accent-red);
}

#reset-btn:hover {
    background-color: #d32f2f;
}

#storage-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.storage-slot {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin-bottom: 2px;
    min-width: 0;
}

.slot-header span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-buttons {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.storage-slot button {
    flex: 1;
    padding: 6px;
    font-size: 1rem;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-info {
    font-size: 0.7rem;
    text-align: left;
    color: #aaa;
    min-height: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.slot-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.mini-distribution {
    display: flex;
    gap: 1px;
    align-items: flex-end;
    height: 12px;
    flex-shrink: 0;
    min-width: 24px;
}

.mini-bar {
    width: 3px;
    background-color: var(--accent-blue);
    min-height: 1px;
    border-radius: 1px 1px 0 0;
    flex-shrink: 0;
}

/* Mobile adjustments while maintaining 3 columns */
@media (max-width: 768px) {
    .storage-slot button {
        font-size: 0.8rem;
        padding: 3px;
    }
    
    .slot-info {
        gap: 3px;
        font-size: 0.6rem;
    }
    
    .slot-header {
        font-size: 0.65rem;
    }
    
    .mini-distribution {
        min-width: 18px;
    }
    
    .mini-bar {
        width: 2px;
    }
}

.slot-btn.save { background-color: var(--accent-green); }
.slot-btn.load { background-color: var(--accent-blue); }
.slot-btn.delete { background-color: var(--accent-red); }

.slot-btn.save:hover { background-color: #388e3c; }
.slot-btn.load:hover { background-color: #1976d2; }
.slot-btn.delete:hover { background-color: #d32f2f; } 