:root {
    --brand-pink: #EB025F;
    --bg-light: #FAFAFA;
}

html, body {
    touch-action: pan-y;
    -ms-touch-action: pan-y;
    overscroll-behavior: none;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: #333;
    /* Lock the body so the web page itself never bounces/scrolls */
    overflow: hidden; 
}

.screen {
    display: flex;
    flex-direction: column;
    /* Use 100dvh so it respects Safari's bottom URL bar */
    height: 100dvh; 
    overflow: hidden;
}

.hidden { display: none !important; }

/* Typography & Utilities */
.text-red { color: var(--brand-pink); }
.bg-pink { background-color: var(--brand-pink); }
.text-white { color: white; }

/* Header & Language Picker */
header {
    display: flex;
    justify-content: space-between;
    padding: 15px 24px;
    align-items: center;
    background-color: var(--bg-light);
    flex-shrink: 0; /* Prevents header from squishing */
}

.lang-picker-container {
    position: relative;
    width: 25px;
    height: 25px;
}

.lang-picker-container img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 4px; 
}

.lang-picker-container select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.icon-btn { background: none; border: none; padding: 0; cursor: pointer; }

/* === DROPDOWN UI LAYOUT === */
#weight-selector-container {
    position: relative;
    z-index: 100;
    margin: 0 20px;
    flex-shrink: 0;
}

.dropdown-header {
    height: 65px;
    border-radius: 32.5px;
    background-color: var(--brand-pink);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 102;
    box-shadow: 0 5px 15px rgba(235, 2, 95, 0.4);
}

.header-metrics-container {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 20px;
}

/* Nudge text to optically center it */
.dropdown-header .metric-col {
    transform: translateY(5px); 
}

.divider {
    width: 1px;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.3);
    align-self: center;
}

.dropdown-content {
    background-color: #C90151; 
    margin: 0; 
    padding-top: 75px; 
    padding-bottom: 20px; 
    border-radius: 32.5px;
    position: absolute;
    width: 100%;
    top: 0; 
    z-index: 101; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    /* Increased the subtraction to 180px to safely clear the bottom tab bar */
    max-height: calc(100dvh - 180px); 
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Metric Grid Rows */
.row-metrics {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 13px 18px;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15); 
    cursor: pointer;
}

.row-metrics:last-child { border-bottom: none; }
.row-metrics.active { background-color: var(--brand-pink); }

.metric-col { 
    display: flex; 
    align-items: baseline; 
    justify-content: center; 
}

/* Font Sizing */
.val { font-size: 25px; font-weight: 500; }
.val-sm { font-size: 18px; font-weight: 500; }
.unit { font-size: 13px; color: #FFB5C9; }

.val-l { font-size: 28px; font-weight: 600; line-height: 1; }
.val-m { font-size: 16px; font-weight: 600; }
.unit-l { font-size: 16px; color: #FFB5C9; }

.row-metrics.active .unit { color: white; }
.row-metrics.active .val, .row-metrics.active .val-sm { font-weight: bold; }

/* === MAIN SCROLLING AREA === */
#content-area { 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Stop whole area from scrolling */
}

#section-title {
    flex-shrink: 0;
    margin: 20px 24px 10px 24px;
    font-size: 20px;
    font-weight: bold;
    background-color: var(--bg-light); /* Makes it look solid */
}

#data-grid { 
    flex-grow: 1;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    /* Changed bottom padding from 100px to 115px to give exactly 20px of breathing room above the Tab Bar */
    padding: 10px 20px 115px 20px; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    align-content: flex-start;
}

.card {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 18px;
    padding: 12px 14px;
    display: flex; 
    justify-content: space-between; 
    box-sizing: border-box;
}

.category-row {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 18px;
    cursor: pointer;
    font-weight: 500;
}

.placeholder { grid-column: span 2; text-align: center; color: #999; padding: 40px 20px; font-size: 14px; }

/* Setup & Modals */
.btn-primary { background-color: var(--brand-pink); color: white; border: none; padding: 18px; border-radius: 30px; font-size: 16px; font-weight: bold; margin: 20px; cursor: pointer; }
.btn-secondary { padding: 8px 16px; margin: 0 20px 15px 20px; border-radius: 20px; border: 1px solid var(--brand-pink); background: none; color: var(--brand-pink); font-weight: bold; cursor: pointer; display: inline-block; }
.btn-back { font-size: 20px; color: var(--brand-pink); border: none; background: transparent; padding: 5px 0 15px 5px; font-weight: bold; cursor: pointer; display: flex; align-items: center; text-align: left; width: 100%; }

.setup-screen { background-color: var(--bg-light); position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; padding-bottom: 50px; justify-content: space-between; }
.setup-content { padding: 50px 30px 20px 30px; text-align: center; flex-grow: 1; }
.setup-content h2 { color: var(--brand-pink); font-size: 26px; margin-bottom: 12px; margin-top: 0; }
.setup-content p { font-size: 16px; color: #666; line-height: 1.4; margin: 0; }
.instruction-box { background: white; border: 1px solid rgba(0,0,0,0.1); border-radius: 18px; padding: 22px; text-align: left; margin-top: 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.instruction-box p { color: #222; font-size: 16px; }

/* Tab Bar */
.bottom-tab-bar {
    position: fixed;
    bottom: 20px; left: 20px; right: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 35px;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    border: 0.5px solid rgba(255,255,255,0.4);
    z-index: 50;
}
.tab { background: none; border: none; color: #9A023E; font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; padding: 10px; border-radius: 20px; cursor: pointer; flex: 1; }
.tab.active { background-color: var(--brand-pink); color: white; }
.tab img { width: 24px; height: 24px; margin-bottom: 5px; transition: transform 0.1s ease; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: flex; align-items: flex-end; z-index: 1000; }
.modal-content { background: white; width: 100%; border-radius: 24px 24px 0 0; padding: 24px; padding-bottom: 60px; box-sizing: border-box; max-height: 90dvh; min-height: 50dvh; overflow-y: auto; animation: slideUp 0.25s ease-out; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.modal-header h3 { margin: 0; font-size: 22px; }
#modal-body { text-align: left; line-height: 1.5; font-size: 16px; color: #000; }
.close-btn { background: #eee; border: none; font-size: 24px; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #666; }

/* Push setup buttons above iOS address bar */
#setup-a2hs .btn-primary, #setup-download .btn-primary { margin-bottom: calc(80px + env(safe-area-inset-bottom)); position: relative; z-index: 10000; }




/* === INFO MENU DROPDOWN === */
.info-dropdown-content {
    position: absolute;
    top: 35px;
    right: 0;
    background-color: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 14px;
    width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    overflow: hidden;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.info-menu-item {
    width: 100%;
    background: none;
    border: none;
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-pink);
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.1s ease;
}

.info-menu-divider {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.08);
    margin: 0;
}

.info-menu-item:active {
    background-color: rgba(235, 2, 95, 0.05);
}




/* BURN CALCULATOR STYLES */
.burn-modal {
    position: fixed;
    inset: 0;
    background: #FAFAFA;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
}

.burn-modal.hidden { display: none !important; }

.burn-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 16px) 16px 12px 16px;
    background: #FAFAFA;
    z-index: 10;
}

.burn-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: #000;
}

.burn-icon-btn, .burn-text-btn {
    background: none;
    border: none;
    color: #EB025F;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px;
}

.burn-workspace {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Left Panel */
.burn-left-panel {
    position: absolute;
    top: 12px;
    left: 20px;
    z-index: 5;
}

.burn-age-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
}

.burn-age-lbl { font-size: 13px; font-weight: 600; color: #888; }
.burn-age-val { font-size: 15px; font-weight: 700; color: #000; }

.burn-tbsa-box {
    background: #EB025F;
    color: #FFF;
    padding: 12px 14px 8px 14px;
    border-radius: 20px;
    width: 95px;
    box-sizing: border-box;
    box-shadow: 0 6px 16px rgba(235, 2, 95, 0.25);
}

.burn-tbsa-title { font-size: 12px; font-weight: 600; opacity: 0.9; }
.burn-tbsa-num {
    font-size: 30px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-top: 2px;
}

/* Right Mini-Map */
.burn-right-panel {
    position: absolute;
    top: 12px;
    right: 20px;
    width: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 5;
}

#burn-mini-svg-wrapper {
    width: 60px;
    height: 115px;
}

#burn-flip-label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    margin-top: 6px;
    text-align: center;
}

/* Center Interactive Map */
.burn-center-map {
    width: 100%;
    height: calc(100% - 110px);
    margin-bottom: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#burn-main-svg-wrapper {
    height: 100%;
    max-height: 520px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#burn-main-svg-wrapper svg, #burn-mini-svg-wrapper svg {
    height: 100%;
    width: auto;
    overflow: visible;
}

.body-part-path {
    fill: #FFFFFF;
    stroke: rgba(0, 0, 0, 0.8);
    stroke-width: 1;
    cursor: pointer;
    transition: fill 0.12s ease;
}

.body-part-path.selected { fill: #F79ABF; }
.body-part-path.active { fill: #EB025F; }

/* Bottom Slider */
.burn-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 36px calc(env(safe-area-inset-bottom, 24px) + 34px) 36px;
    background: linear-gradient(to top, #FAFAFA 85%, rgba(250, 250, 250, 0));
    z-index: 10;
}

.burn-bottom-bar .hidden { display: none !important; }

.burn-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

#burn-cov-label { font-size: 16px; font-weight: 700; color: rgba(0, 0, 0, 0.8); }
#burn-cov-val { font-size: 22px; font-weight: 700; color: #EB025F; }

#burn-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    margin: 10px 0;
}

/* Larger grab thumb for iOS / Safari / Chrome */
#burn-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #EB025F;
    border: 3px solid #FFFFFF;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

/* Larger grab thumb for Firefox */
#burn-slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #EB025F;
    border: 3px solid #FFFFFF;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

#burn-hint-text {
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: #888;
    margin: 0 0 12px 0;
}

/* Trigger Button in SOS -> Burns List */
.burn-calc-trigger-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    margin-bottom: 12px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    font-size: 16px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
}
