:root {
    --font-size: 16px;
    --font-family: Arial;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0 auto;
    padding: 20px;

    font-family: var(--font-family);
    background-color: #ffffff;
    overflow-x: scroll;
    font-size: var(--font-size);

    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Typography */
h2 {
    margin-top: 2px;
}

/* Layout helpers */
.flex {
    display: flex;
}

.wrap {
    flex-wrap: wrap;
}

.gap {
    gap: 15px;
}

/* Top row */
.top-row {
    display: flex;
    gap: 15px;
    align-items: stretch;
    flex-wrap: wrap;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    /* allow wrapping */
    width: 100%;
}

#online {
    flex: 1;
    min-width: 0;
    white-space: normal;
    /* allow wrapping */
    overflow-wrap: anywhere;
}


/* Cards */
.card {
    padding: 12px;
    border-radius: 5px;
    line-height: 1.4;
    overflow-wrap: break-word;
}

/* Time / TPS */
#time {
    background: #ffff8d;
    flex: 3;
    min-width: 280px;
}

#tps {
    background: #ddd;
    flex: 0.5;
    min-width: 120px;
    display: flex;
}

/* Bars */
.bar-flexbox {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 15px;
}

.bar-container {
    flex: 3;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

#main_lngi_bar {
    background: #bcd;
    padding: 3px;
    white-space: nowrap;
    transition: width 0.05s ease;
}

/* Panels */
#main_lngi {
    background: #ffccdd;
    font-weight: bold;

    overflow: auto;

    min-height: 60px;
    height: 60px;
}

#main_lngi_Content {
    font-size: calc(var(--font-size) * 1.6);
}

/* Scratch area */
#scratch_bars {
    background: #dcdcdc;

    position: relative;
    height: 255px;
    min-height: 155px;

    overflow-y: hidden;
    overflow-x: hidden;

    padding: 5px;
}

#scratch_content {
    overflow-y: auto;
    overflow-x: hidden;

    height: 100%;
}

#scratch_content>div:not(.resize-handle) {
    position: relative !important;
    top: auto !important;

    width: 100%;
    min-height: var(--scratch-bar-height, 24px);

    margin-bottom: 4px;
    padding: 2px 6px;

    border-radius: 3px;
    white-space: nowrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.25);
    justify-content: center;
    align-items: center;

    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 800px;
    max-width: 90vw;

    height: 400px;
    max-height: 60vw;

    background: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);

    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 12px 16px;
    border-bottom: 1px solid #ddd;
}

.modal-body {
    padding: 16px;
}

#close_settings {
    border: none;
    background: none;
    cursor: pointer;
}

/* Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 15px;
    margin-bottom: 12px;
}

.setting-row label {
    font-weight: bold;
}

.setting-row select {
    min-width: 180px;
    padding: 4px 8px;
}

/* Checkbox layout */
.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.checkbox-row label {
    cursor: pointer;
}

/* Resizable utility */
.resizable {
    position: relative;
    overflow: auto;
}

.resize-handle {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    height: 16px;
    cursor: ns-resize;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    z-index: 10;
}

.resize-handle::before {
    content: "";
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #888;
}

#btn_lngi {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #67a9ff;
    cursor: pointer;
    white-space: nowrap;
}

#btn_progress {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #00ffdd62;
    cursor: pointer;
    white-space: nowrap;
}

#btn_search {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #70ff7c;
    cursor: pointer;
    white-space: nowrap;
}

#btn_milestone {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #e9ff85;
    cursor: pointer;
    white-space: nowrap;
}

#mountain_btn {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #ff8484;
    cursor: pointer;
    white-space: nowrap;
}

#settings_btn {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
    white-space: nowrap;
}

#future-milestone {
    background-color: rgba(0, 0, 0, 0);
    text-align: center;
    border-radius: 10px;
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: stretch;
}

.extreme_step {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #ffae00;
    cursor: pointer;
    white-space: nowrap;
}

.high_step {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #ffee00;
    cursor: pointer;
    white-space: nowrap;
}

.normal_step {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #c8ff00;
    cursor: pointer;
    white-space: nowrap;
}

#milestone_header {
    display: none;
    flex-direction: column;
    gap: 10px;

    background: #dcdcdc;
    padding: 10px;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-row label {
    white-space: nowrap;
}

#Scratch_bar_height {
    width: 70px;
}

#time_mode {
    margin-left: auto;

    padding: 5px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;

    background: #000;
    color: white;
    cursor: pointer;
}

.analysis-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
}

#analysis_container {
    display: flex;
    box-sizing: border-box;
    flex-wrap: wrap;
    gap: 15px;
}

.analysis-panel {
    background: #ddd;
    overflow-y: auto;
    scrollbar-gutter: stable;
    /* <- add this */

    min-height: 30px;
    height: 150px;

    position: relative;
    border-radius: 5px;
}

.analysis-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.analysis-header button,
.analysis-header select {
    flex: 0 1 auto;
    min-width: 0;
}

.analysis-content {
    font-size: calc(var(--font-size) * 1.35);
    margin-top: 10px;
}

#mountain {
    min-height: 500px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background: #fff;
}

#outputcontainersquared {
    width: 100%;
}

#outputcontainer {
    max-width: 100%;
}

#output {
    display: block;
    max-width: 100%;
    height: auto;
}

#actualcontainer,
#secondcontainer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    /* 12px vertical, 24px horizontal */
}

#actualcontainer>label,
#secondcontainer>label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* space between label and input */
    white-space: nowrap;
    /* keep label + input together */
    flex: 0 0 auto;
    /* don't stretch */
}

.fmilestone-box {
    flex: 1;
    background-color: #ffff8d;
    border-radius: 10px;
}

.fmilestone-box2 {
    padding: 10px;
    flex: 1;
    background-color: #b6e8ff;
    border-radius: 10px;
    min-height: 100px;
}

.time-control-panel {
    margin: 0;
    /* remove the extra spacing */
    padding: 10px;
    border-radius: 10px;
    background: rgba(0, 179, 0, .55);

    display: flex;
    gap: 15px;
    align-items: center;

    width: 100%;
    box-sizing: border-box;
}

#real_milestones {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

#real_milestones::-webkit-scrollbar {
    display: none;
}


.tmilestone-box {
    padding: 10px;
    border-radius: 3px;
    width: 100%;
    margin-top: 3px;
}

.milestone_sub_box {
    flex: 1;
    overflow-wrap: anywhere;
}