:root {
    --background-color: #fff;
    --color: #333;
    --muted-color: #666;
    --border-radius: 0.5rem;
    --card-box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --primary: #3498db;
    --primary-focus: rgba(52, 152, 219, 0.2);

    /* Simulation colors */
    --canvas-background: #f0f0f0;
    --initial-balance-color: #555;
    --contribution-color: #3498db;
    --interest-color: #2ecc71;
    --debt-color: crimson;
}

body {
    background-color: var(--background-color);
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.controls {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 10;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    background: rgba(241, 241, 241, 0.85);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-box-shadow);
    color: var(--color);
    transform: none;
}

.controls button {
    padding: 0.5rem 0.75rem;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #555;
    margin: 0;
}

#shareBtn {
    margin-right: 0;
}

.divider {
    width: 1px;
    height: 2rem;
    background-color: #ccc;
    margin: 0 0.5rem;
}

.controls button .material-symbols-outlined {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: inherit;
}

.controls button:disabled {
    background-color: #e0e0e0;
    color: #a0a0a0;
    cursor: not-allowed;
    user-select: none;
}

#speedDisplay {
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}
#paramsDisplay {
    font-size: 0.75rem;
    color: var(--muted-color);
    font-family: monospace;
}
#info-display {
    position: absolute;
    top: 0rem;
    left: 2rem;
    z-index: 5;
    background: rgba(241, 241, 241, 0.85); /* Semi-transparent light */
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-box-shadow);
    min-width: 500px;
    color: var(--color);
}

#info-display .grid {
    grid-template-columns: 1fr 1fr;
    grid-gap: 1rem;
}

#info-display .grid > div:first-child {
    border-right: 1px solid #ccc;
    padding-right: 1rem;
}

#info-display h2 {
    margin-top: 0 !important;
}
#info-display p {
    color: var(--muted-color);
    margin-bottom: 0.5rem;
    margin-top: 0;
}

#interestAmount {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

#legend span {
    color: var(--muted-color);
}

#billValue {
    color: var(--color);
}
dialog[open] {
    max-width: 600px;
    width: 90%;
}

#simulationModal .form-grid {
    gap: 1rem;
}

.form-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-row.half-width {
    width: 50%;
}

#simulationModal .form-group {
    display: flex;
    flex-direction: column;
}

#simulationModal .form-group label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

#simulationModal .form-group label small {
    color: var(--muted-color);
    font-style: italic;
    font-size: 0.8em;
}

#simulationModal input, #simulationModal select {
    font-size: 0.8rem;
    padding: 0.4rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

#simulationModal input:focus, #simulationModal select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-focus);
}

#simulationModal header {
    margin-bottom: 1.5rem;
    position: relative;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-container .material-symbols-outlined {
    font-size: 2.0rem; /* Adjusted icon size */
}

#simulationModal .material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24
}

#simulationModal header h2 {
    margin-bottom: 0.25rem;
}

#simulationModal header p {
    margin: 0;
    color: var(--muted-color);
}

#simulationModal footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

#scale-container {
    position: fixed;
    bottom: 5rem;
    right: 8rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#scale-line {
    position: relative;
    height: 2px;
    background-color: #000;
    box-shadow: 0 0 2px rgba(255,255,255,0.7);
}

#scale-line::before,
#scale-line::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 2px;
    height: 10px;
    background-color: #000;
    box-shadow: 0 0 2px rgba(255,255,255,0.7);
}

#scale-line::before {
    left: 0;
}

#scale-line::after {
    right: 0;
}

#scale-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #000;
    margin-top: 0.5rem;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.7);
}


@media (max-width: 768px) {
    #info-display {
        min-width: 0;
        width: calc(100% - 2rem);
        left: 1rem;
        top: 1rem;
        position: fixed;
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    #info-display h2 {
        font-size: 1.1rem;
    }

    #info-display p {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }

    #interestAmount {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    #legend {
        font-size: 11px;
    }

    .controls {
        bottom: 1rem;
        left: 1rem;
        width: calc(100% - 2rem);
        justify-content: center;
    }

    #scale-container {
        bottom: 5rem;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }

    #billValue {
        display: none;
    }

    dialog[open] {
        max-width: 90vw;
    }
}

#simulationModal #themeSwitcherBtn {
    position: absolute;
    top: 1.25rem;
    right: 3.5rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#simulationModal .close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1rem;
    height: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    padding: 0.5rem;
    display: none;
}

#simulationModal .close::before,
#simulationModal .close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #888;
    transform-origin: center;
}

#simulationModal .close::before {
    transform: translateY(-50%) rotate(45deg);
}

#simulationModal .close::after {
    transform: translateY(-50%) rotate(-45deg);
}

#shareDialog[open] {
    max-width: 400px;
}

#shareDialog header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#shareDialog .close {
    position: static;
    padding: 0;
    margin-left: 1rem;
}

#shareDialog input[type="text"] {
    width: 100%;
    margin-bottom: 1rem;
}

#shareDialog label {
    display: block;
    margin-bottom: 1rem;
}

#shareDialog footer {
    display: flex;
    justify-content: flex-end;
}

[data-theme='dark'] {
    --background-color: #121212;
    --color: #ffffff;
    --muted-color: #a0a0a0;
    --card-background: rgba(42, 42, 42, 0.85);
    --card-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --control-background: rgba(42, 42, 42, 0.85);
    --button-background: #333333;
    --button-border: #555555;
    --button-color: #ffffff;
    --divider-color: #555555;
    --scale-color: #ffffff;
    --scale-shadow: 0 0 2px rgba(0, 0, 0, 0.7);
    --info-display-border: #555555;

    /* Simulation colors */
    --canvas-background: #000000;
    --initial-balance-color: #aaaaaa;
    --contribution-color: #3498db;
    --interest-color: #2ecc71;
    --debt-color: #ff6347; /* tomato */
}

[data-theme='dark'] .controls {
    background: var(--control-background);
    box-shadow: var(--card-box-shadow);
    color: var(--color);
}

[data-theme='dark'] .controls button {
    background-color: var(--button-background);
    border: 1px solid var(--button-border);
    color: var(--button-color);
}

[data-theme='dark'] .divider {
    background-color: var(--divider-color);
}

[data-theme='dark'] #info-display {
    background: var(--card-background);
    box-shadow: var(--card-box-shadow);
    color: var(--color);
}

[data-theme='dark'] #info-display .grid > div:first-child {
    border-right: 1px solid var(--info-display-border);
}

[data-theme='dark'] #scale-line {
    background-color: var(--scale-color);
    box-shadow: var(--scale-shadow);
}

[data-theme='dark'] #scale-line::before,
[data-theme='dark'] #scale-line::after {
    background-color: var(--scale-color);
    box-shadow: var(--scale-shadow);
}

[data-theme='dark'] #scale-label {
    color: var(--scale-color);
    text-shadow: var(--scale-shadow);
}
