:root {--bgColor: #f1f5f9; --cardBg: #ffffff; --txtColor: #1e293b; --txtMuted: #64748b; --borderColor: #cbd5e1; --linkColor: #0369a1; --linkHover: #075985; --focusBorder: #0284c7; --focusRing: rgba(2, 132, 199, 0.15); --trEvenBgColor: #f8fafc; --submitBg: #0369a1; --submitHover: #075985; --mathGreen: #059669; --alertOrange: #d97706}
[data-theme="darkMode"] {--bgColor: #0b1120; --cardBg: #131d31; --txtColor: #f8fafc; --txtMuted: #94a3b8; --borderColor: #26354f; --linkColor: #38bdf8; --linkHover: #7dd3fc; --focusBorder: #38bdf8; --focusRing: rgba(56, 189, 248, 0.2); --trEvenBgColor: #182339; --submitBg: #38bdf8; --submitHover: #0284c7; --mathGreen: #34d399; --alertOrange: #fbbf24}
* {margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif}
body {font-size: 16px; background: var(--bgColor); color: var(--txtColor); transition: background .2s ease, color .2s ease; line-height: 1.5; -webkit-font-smoothing: antialiased}
a {text-decoration: none; color: var(--linkColor); transition: color 0.15s ease} a:hover {text-decoration: none; color: var(--linkHover)}
input, textarea, select {background: var(--cardBg); color: var(--txtColor); border: 1px solid var(--borderColor); border-radius: 6px; padding: 8px 12px; font-size: inherit; transition: all 0.2s ease} 
input:focus, textarea:focus, select:focus {outline: none; border-color: var(--focusBorder); box-shadow: 0 0 0 3px var(--focusRing); background: var(--cardBg)}
h1, h2, h3, h4, h5, h6 {margin: 20px 0; color: var(--txtColor); font-weight: 700} p {line-height: 1.6; color: var(--txtMuted); word-wrap: break-word; overflow-wrap: break-word} strong {color: var(--txtColor)}
pre, code {word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace}
.cb {clear: both} .cl {clear: left} .cr {clear: right} .fl {float: left} .fr {float: right} .fn {float: none}
.center {text-align: center} .hidden {display: none !important} .bold {font-weight: bold} .italic {font-style: italic} .border {border: solid 1px var(--borderColor); border-radius: 6px}
.wrapper {width: 100%; max-width: 1200px; margin: auto; padding: 0 16px}
.setting, .header, .body, .footer {width: 100%; display: flow-root} .setting {margin-top: 10px} .header {margin: 20px 0 30px 0} .footer {margin: 30px 0; text-align: center; color: var(--txtMuted)}
.settingL, .settingR, .headerL, .headerR {width: 50%; float: left; padding: 5px 10px} .settingR {text-align: right}
.bodyL, .bodyR {width: 75%; float: left; padding: 10px 20px 10px 0} .bodyR {width: 25%; padding: 10px 0 10px 20px; border-left: 1px solid var(--borderColor)}
.altThemeBtn {background: var(--cardBg); border: 1px solid var(--borderColor); font-size: 14px; color: var(--txtColor); cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: all 0.2s ease} 
.altThemeBtn:hover {border-color: var(--focusBorder); background: var(--trEvenBgColor)}
.altThemeBtn.active {border-color: var(--linkColor); color: var(--linkColor); font-weight: 600; background: var(--trEvenBgColor)}
.fontSizeBox {padding: 4px 8px; min-width: 120px; font-size: 14px}
.logo, .slogan, .logo:hover, .slogan:hover {color: var(--txtColor); text-decoration: none} .logo {font-size: 26px; font-weight: 800; color: var(--linkColor)} .slogan {font-size: 14px; color: var(--txtMuted)}
.searchContainer {position: relative; width: 100%}
.searchWrapper {display: flex; align-items: stretch; width: 100%}
.searchDropdown {position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--cardBg); border: 1px solid var(--borderColor); border-radius: 6px; box-shadow: 0 8px 16px rgba(0,0,0,0.12); z-index: 1000; max-height: 340px; overflow-y: auto; display: none; text-align: left}
.searchDropdown.active {display: block}
.searchItem {padding: 10px 14px; border-bottom: 1px solid var(--borderColor); display: block; text-decoration: none; color: var(--txtColor); transition: background 0.15s ease}
.searchItem:last-child {border-bottom: none}
.searchItem:hover, .searchItem.selected {background: var(--trEvenBgColor); text-decoration: none}
.searchItemCat {display: inline-block; font-size: 11px; font-weight: bold; background: var(--trEvenBgColor); color: var(--linkColor); padding: 2px 6px; border-radius: 3px; margin-right: 6px; text-transform: uppercase}
.searchItemName {font-weight: 600; font-size: 14px; color: var(--txtColor)}
.searchItemDesc {font-size: 12px; color: var(--txtMuted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis}
#sInput {flex: 3; height: 2.4em; padding: 0 12px; border: 1px solid var(--borderColor); border-radius: 6px 0 0 6px}
#sInput:focus {border-right: 1px solid var(--focusBorder)}
#sButton {flex: 1; height: 2.4em; font-size: inherit; background: var(--submitBg); color: #fff; font-weight: bold; border: none; border-radius: 0 6px 6px 0; cursor: pointer; transition: background 0.2s ease}
#sButton:hover {background: var(--submitHover)}
.blockTool, .blockText, .blockList {width: 100%; margin-bottom: 20px; background: var(--cardBg); border: 1px solid var(--borderColor); border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: box-shadow 0.2s ease}
.blockTool:empty {display: none}
.blockTool:hover, .blockList:hover {box-shadow: 0 4px 6px rgba(0,0,0,0.05)}
.blockText {background: transparent; border: none; padding: 0; box-shadow: none}
.blockTool p, .blockTool textarea, .blockTool input, .blockText p {margin: 10px 0}
.inputBox, .inputArea {width: 100%; min-height: 38px; border: 1px solid var(--borderColor); border-radius: 6px; padding: 10px; font-size: inherit; font-family: inherit}
.inputArea {min-height: 200px; resize: vertical}
.submitBtn {background: var(--submitBg); color: #FFF; border: none; border-radius: 6px; font-size: 15px; font-weight: 600; padding: 10px 24px; cursor: pointer; transition: all 0.2s ease}
.submitBtn:hover {background: var(--submitHover); transform: translateY(-1px)} .submitBtn:active {transform: translateY(0)} .submitBtn:disabled {background: var(--borderColor); color: var(--txtMuted); cursor: not-allowed; transform: none}
.success {color: var(--mathGreen); font-weight: 600} .error {color: #dc2626; font-weight: 600} .inputError {border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important}
.guideList li {margin: 8px 0 8px 20px; color: var(--txtMuted)} .specList li {margin: 8px 0 8px 40px; color: var(--txtMuted)}
.resultTable {width: 100%; border-collapse: collapse; margin: 12px 0; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch}
.resultTable tr:nth-child(even), .resultTable tr.targetRow {background: var(--trEvenBgColor)}
.resultTable tr.targetRow {font-weight: bold}
.resultTable th, .resultTable td {text-align: left; border: 1px solid var(--borderColor); padding: 10px; color: var(--txtColor); word-wrap: break-word; overflow-wrap: break-word}
.resultTable th {background: var(--trEvenBgColor); font-weight: 600}
.tabularNums, .resultTable td, .calcDisplay, .unitVal {font-variant-numeric: tabular-nums; -webkit-font-feature-settings: "tnum"; font-feature-settings: "tnum"}
.cImg img {max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 16px auto; box-shadow: 0 4px 6px rgba(0,0,0,0.05)}
.cImg figcaption {text-align: center; font-style: italic}
.sticker {margin: 16px 0 6px 0; line-height: 1.3}
.linkList li {list-style: none; margin: 6px 0}
.linkList a {display: inline-block; padding: 6px 12px; background: var(--bgColor); border: 1px solid var(--borderColor); border-radius: 6px; width: 100%; transition: all 0.2s ease}
.linkList a:hover {background: var(--trEvenBgColor); border-color: var(--focusBorder); text-decoration: none; padding-left: 16px}
#F, #X, #P {padding: 6px 14px; background: #1877f2; color: #FFF; font-weight: bold; border: none; border-radius: 4px; cursor: pointer; transition: all 0.2s ease} #X {background: #1d9bf0} #P {background: #e60023}
#F:hover, #X:hover, #P:hover {transform: translateY(-1px); opacity: 0.9}
.floor {width: 100%; padding: 20px; margin: 0 0 16px 0; border: 1px solid var(--borderColor); border-radius: 8px; background: var(--cardBg); box-shadow: 0 1px 3px rgba(0,0,0,0.02); transition: all 0.2s ease}
.floor:hover {box-shadow: 0 4px 6px rgba(0,0,0,0.05); border-color: var(--focusBorder)}
.blockTool h2, .floor h2 {display: flex; align-items: center; gap: 8px; margin-top: 0}
.hubIcon {display: inline-flex; align-items: center; justify-content: center; color: var(--linkColor); flex-shrink: 0; width: 20px; height: 20px}
.room {width: 50%; float: left; padding: 6px}
.room h3 {margin: 4px 0 6px 0; font-size: 1.05rem}
.room p {margin: 0 0 6px 0; font-size: 0.95rem; line-height: 1.45}
.floor h3 {margin: 0 0 6px 0; font-size: 1.15rem}
.floor p {margin: 0; line-height: 1.5}
.adsTop, .adsMiddle, .adsRight, .adsBottom {display: none; width: 100%; text-align: center; margin: 0 auto; overflow: hidden}
.adsTop:not(:empty) {display: flex; align-items: center; justify-content: center; min-height: 90px; max-height: 100px; max-width: 970px; margin-bottom: 20px}
.adsMiddle:not(:empty) {display: flex; align-items: center; justify-content: center; min-height: 250px; margin: 20px 0; padding: 20px; background: var(--cardBg); border: 1px solid var(--borderColor); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05)}
.adsRight:not(:empty) {display: flex; align-items: center; justify-content: center; min-height: 250px; margin-top: 20px; padding: 20px; background: var(--cardBg); border: 1px solid var(--borderColor); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); max-width: 100%}
.adsBottom:not(:empty) {display: flex; align-items: center; justify-content: center; min-height: 90px; margin-top: 20px}
[data-theme="darkMode"] .adsTop, [data-theme="darkMode"] .adsMiddle, [data-theme="darkMode"] .adsRight, [data-theme="darkMode"] .adsBottom {filter: opacity(0.85); transition: filter 0.2s ease}
[data-theme="darkMode"] .adsTop:hover, [data-theme="darkMode"] .adsMiddle:hover, [data-theme="darkMode"] .adsRight:hover, [data-theme="darkMode"] .adsBottom:hover {filter: opacity(1)} [data-theme="darkMode"] input[type="date"]::-webkit-calendar-picker-indicator {filter: invert(0.8); cursor: pointer}
@media (max-width: 768px) {
    .settingL, .settingR, .headerL, .headerR {width: 100%; float: none; text-align: center; padding: 5px}
    .bodyL, .bodyR {width: 100%; float: none; padding: 10px 0; border: none}
    .header {margin: 10px 0 20px 0}
    .room {width: 100%; float: none; border-bottom: 1px solid var(--borderColor); padding: 10px 6px}
    #sInput {flex: 7} #sButton {flex: 3}
}
@media (min-width: 769px) and (max-width: 1024px) {.bodyL {width: 70%} .bodyR {width: 30%}}
#loading {font-weight: bold; color: #0284c7; animation: blink 0.25s ease-in-out infinite alternate}
@keyframes blink {from {opacity: 1} to {opacity: 0.3}}

.utilityBar {display: flex; justify-content: flex-end; gap: 6px; padding: 6px 10px; background: var(--bgColor); border: 1px solid var(--borderColor); border-bottom: none; border-radius: 6px 6px 0 0; width: 100%}
.utilityBar + .inputArea, .utilityBar + .inputBox, .utilityBar + label .inputArea, .utilityBar + label .inputBox {border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; margin-top: 0 !important}
.utilityBtn {display: inline-flex; align-items: center; justify-content: center; background: var(--cardBg); color: var(--txtMuted); border: 1px solid var(--borderColor); border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; line-height: 1.2; user-select: none; white-space: nowrap}
.utilityBtn:hover {color: var(--focusBorder); border-color: var(--focusBorder); background: var(--trEvenBgColor)}
.utilityBtn:active {transform: scale(0.96)}
.utilityBtn.success {background: rgba(5, 150, 105, 0.1); border-color: #059669; color: #059669}

.blockTool .calcForm input, .blockTool .calcForm select, .blockTool .calcForm textarea, .blockTool .calcForm button {margin: 0}
.calcForm {display: flex; flex-direction: column; gap: 16px; width: 100%}
.formRow {display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; width: 100%}
.formGrid {display: grid; gap: 16px; width: 100%}
.formGrid2 {display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; width: 100%}
.formGrid3 {display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%}
.formGrid4 {display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; width: 100%}
.formField {display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; min-width: 0}
.formFieldFull {width: 100%; max-width: 100%; flex: 1 1 100%}
.formLabel {font-size: 13px; font-weight: 600; color: var(--txtColor); line-height: 1.2}
.calcForm .inputBox {height: 42px; min-height: 42px; padding: 8px 12px; margin: 0}
input:disabled, select:disabled, textarea:disabled {background: var(--trEvenBgColor); opacity: 0.65; cursor: not-allowed; border-color: var(--borderColor)}

.inputAddon {display: flex; align-items: stretch; width: 100%; position: relative}
.inputAddon > input {flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; margin: 0; height: 42px}
.inputAddon > input:focus {z-index: 1}
.inputAddon > .addonText, .inputAddon > select {display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 14px; background: var(--trEvenBgColor); border: 1px solid var(--borderColor); border-left: none; border-radius: 0 6px 6px 0; color: var(--txtMuted); font-weight: 600; font-size: 14px; flex-shrink: 0; margin: 0; box-sizing: border-box}
.inputAddon > .addonText:first-child {border-right: none; border-left: 1px solid var(--borderColor); border-radius: 6px 0 0 6px}
.inputAddon > .addonText:first-child + input {border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: 6px; border-bottom-right-radius: 6px}

.inputSuffix {position: relative; width: 100%}
.inputSuffix > input {width: 100%; padding-right: 36px; margin: 0; height: 42px}
.inputSuffix > .suffixText {position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--txtMuted); font-weight: 600; font-size: 14px; pointer-events: none; line-height: 1}
.btnSwapInline {display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; min-width: 42px; background: var(--cardBg); color: var(--txtMuted); border: 1px solid var(--borderColor); border-radius: 6px; cursor: pointer; align-self: flex-end; margin-bottom: 0; transition: all 0.2s ease; flex-shrink: 0}
.btnSwapInline:hover {color: var(--focusBorder); border-color: var(--focusBorder); background: var(--trEvenBgColor)}
.btnSwapInline svg {transition: transform 0.3s ease}
.btnSwapInline:active svg {transform: rotate(180deg)}
.fieldActions {display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px}
.fieldActions .utilityBtn {height: 28px; padding: 0 10px; font-size: 12px; border-radius: 4px; align-self: flex-start}
.formFieldSwap {flex: 0 0 auto; max-width: 42px}

.formOptionsRow {display: flex; align-items: center; gap: 12px; width: 100%}
.formOptionsRow label {display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; cursor: pointer}
.formActions {display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px}
.formActions .utilityBtn {height: 36px; padding: 0 16px; font-size: 13px; font-weight: 600; border-radius: 6px}

.leadResult {font-size: 1.25rem; font-weight: 700; margin: 8px 0; color: var(--txtColor)}
.unitBadge {display: inline-block; padding: 2px 8px; background: var(--trEvenBgColor); border: 1px solid var(--borderColor); border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--linkColor)}
.unitDesc, .subText {font-size: 0.95rem; font-weight: normal; color: var(--txtMuted)}
.formulaNote {font-size: 0.95rem; color: var(--txtMuted); margin: 6px 0}
.multiRowTable {width: 100%; border-collapse: collapse; margin: 10px 0}

.timerDisplay {font-size: 2.75rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; text-align: center; color: var(--txtColor); margin: 12px 0}
.timerStatus {text-align: center; font-size: 14px; color: var(--txtMuted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px}

.meterTrack {width: 100%; height: 12px; background: var(--trEvenBgColor); border: 1px solid var(--borderColor); border-radius: 6px; overflow: hidden; margin: 8px 0}
.meterFill {height: 100%; background: var(--mathGreen); transition: width 0.3s ease}
.meterFillDanger {background: #dc2626}

.fracWrap {display: inline-flex; align-items: center; vertical-align: middle; gap: 4px}
.fracStack {display: inline-flex; flex-direction: column; text-align: center; font-size: 0.9em; line-height: 1.1}
.fracBar {border-top: 1.5px solid var(--txtColor); width: 100%}

@media (max-width: 640px) {
    .formField, .formFieldFull {max-width: 100%; flex: 1 1 100%}
    .formGrid2, .formGrid3, .formGrid4 {grid-template-columns: 1fr}
    .timerDisplay {font-size: 2.1rem}
    .btnSwapInline {align-self: center; margin: -4px 0}
    .btnSwapInline svg {transform: rotate(90deg)}
    .btnSwapInline.success svg {transform: none}
    .formFieldSwap {max-width: 100%; width: 100%; align-items: center; margin: -4px 0}
    .formFieldSwap .formLabel {display: none}
    .formActions {display: flex; flex-wrap: wrap; gap: 8px; width: 100%}
    .formActions .submitBtn {width: 100%; height: 42px; order: -1; justify-content: center}
    .formActions .utilityBtn {flex: 1 1 calc(50% - 8px); height: 38px; min-width: 100px; justify-content: center; padding: 0 10px; white-space: nowrap}
}
@media (max-width: 576px) {
    .utilityBar {padding: 6px 6px; gap: 4px}
}