* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #050816;
    color: #e8eefc;
    font-family: Inter, system-ui, Arial, sans-serif;
}

#simCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    cursor: crosshair;
}

.panel {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;

    padding: 16px;
    border-radius: 14px;
    background: rgba(12, 18, 34, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.panel::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 8px;
}

.panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 8, 20, 0.1);
    z-index: 100;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    position: relative;
    width: min(760px, 100%);
    max-height: min(86vh, 900px);
    overflow-y: auto;
    padding: 22px 22px 18px;
    border-radius: 16px;
    background: rgba(54, 60, 78, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.15);
    color: #edf2ff;

    transform: translateX(160px);
}

.modal h2 {
    margin: 0 36px 14px 0;
    font-size: 24px;
}

.modal h3 {
    margin: 18px 0 8px;
    font-size: 17px;
    color: #ffffff;
}

.modal p,
.modal li {
    font-size: 14px;
    line-height: 1.5;
    color: #d8e2fb;
}

.modal ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.modal-content {
    padding-right: 4px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.formula {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    font-family: "Times New Roman", serif;
    font-size: 20px;
    color: #ffffff;
}

.formula-inline {
    font-family: "Times New Roman", serif;
    font-size: 17px;
    color: #ffffff;
}

.modal::-webkit-scrollbar {
    width: 8px;
}

.modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 8px;
}

.modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

.panel h1 {
    margin: 0 0 10px;
    font-size: 22px;
}

.hint {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.35;
    color: #b8c5e3;
}

.field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.field label {
    font-size: 14px;
    color: #dfe7fb;
}

.field input[type="number"] {
    width: 120px;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid #2c3a61;
    background: #0f1730;
    color: #eef3ff;
    outline: none;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 10px 0;
    font-size: 14px;
    cursor: pointer;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

button {
    padding: 9px 12px;
    border: none;
    border-radius: 9px;
    background: #2d63ff;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #4475ff;
}

.stats {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.4;
    color: #b8c5e3;
}