:root {
    --primary-color: #007aff;
    --bg-color: #f2f2f7;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-sub: #8e8e93;
    --border-color: #e5e5ea;
    --highlight-bg: #f0f8ff;
    --danger-color: #ff3b30;
    --font-mono: Consolas, "Monaco", "Courier New", monospace;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 10px;
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
}

.container {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

/* === Header === */
.header {
    background-color: #fff;
    color: var(--text-main);
    padding: 20px 15px 10px 15px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #000;
}

.citation {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.subtitle {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Alias for citation */

/* === Controls & Layout === */
.controls {
    padding: 15px;
    border-bottom: 1px solid #efefef;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-desc {
    font-weight: normal;
    font-size: 0.75rem;
    color: #888;
    margin-left: 5px;
}

input,
select {
    width: 100%;
    height: 36px;
    padding: 0 5px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    background-color: #fff;
    appearance: none;
    margin-bottom: 0;
    text-align: center;
    transition: border-color 0.2s;
    color: #000;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Grid System */
.row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.row.last {
    margin-bottom: 0;
}

.col {
    flex: 1;
    min-width: 0;
}

.aligned-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 15px 10px;
    margin-bottom: 12px;
    align-items: end;
}

/* === Tabs === */
.tabs {
    display: flex;
    background-color: #fff;
    border-bottom: 1px solid #ebedf0;
}

.tab-btn {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sub);
    position: relative;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    display: none;
    padding: 15px;
}

.tab-content.active {
    display: block;
}

/* === Result Card === */
.result-card {
    background-color: var(--highlight-bg);
    border-radius: 12px;
    padding: 15px 10px;
    margin-top: 15px;
    text-align: center;
    border: 1px solid rgba(0, 122, 255, 0.1);
    display: none;
    animation: fadeIn 0.3s ease-out;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-line {
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
}

.main-val {
    font-size: 30px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.unit-main {
    font-size: 15px;
    color: var(--text-sub);
    font-weight: 500;
}

.sub-info {
    font-size: 13px;
    color: var(--text-sub);
    margin-left: 4px;
}

/* === Custom Card Extras (e.g. for Flow Meter) === */
.settings-box {
    display: flex;
    justify-content: space-between;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-top: 10px;
    gap: 10px;
}

.mini-control {
    flex: 1;
}

.mini-control label {
    display: block;
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 2px;
}

.mini-control select {
    height: 32px;
    font-size: 14px;
    padding: 0 5px;
}

.match-info {
    margin-top: -10px;
    margin-bottom: 15px;
    padding: 12px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #0d47a1;
    line-height: 1.5;
    display: none;
}

/* === Footer === */
.footer {
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    margin-top: 20px;
}

.input-group {
    margin-bottom: 12px;
}

/* === Thermocouple Extras === */
.tolerance-box {
    margin-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 10px;
    display: flex;
    justify-content: space-around;
}

.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.param-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #eee;
}

.param-label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

.param-val {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
}

.param-unit {
    font-size: 0.75rem;
    color: #888;
}

/* === Tolerance List === */
.tolerance-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
}

.tol-item {
    font-size: 12px;
    color: #555;
    display: flex;
    justify-content: space-between;
}

.tol-label {
    color: #888;
    font-weight: 500;
}

.tol-value {
    font-weight: 600;
    color: #333;
}

/* === Extra Utils for other plugins === */
.error-msg {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: bold;
    display: none;
    text-align: center;
}

.log-area {
    margin-top: 20px;
    border-top: 1px dashed #ccc;
    padding: 15px;
    display: none;
    background-color: #fafafa;
}

.log-item {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 10px;
}

.log-title {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
    font-weight: bold;
    border-left: 3px solid var(--primary-color);
    padding-left: 8px;
}

.log-math {
    font-size: 0.9rem;
    overflow-x: auto;
    color: #333;
}

/* === Radiance Thermometer Extras === */
.conversion-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.big-input-group {
    position: relative;
    background-color: white;
    border: 2px solid #e5e5ea;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.2s;
}

.big-input-group.active {
    border-color: #007aff;
    background-color: #faffff;
    transform: scale(1.01);
}

.big-label {
    font-size: 0.85rem;
    color: #8e8e93;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.big-input {
    border: none;
    font-size: 2rem;
    font-weight: 600;
    color: #1c1c1e;
    background: transparent;
    font-family: -apple-system, monospace;
    padding: 5px 0;
    margin: 0;
    width: 100%;
}

.big-input:focus {
    box-shadow: none;
    outline: none;
}

.big-unit-label {
    position: absolute;
    right: 15px;
    bottom: 22px;
    color: #aeaeb2;
    font-size: 1rem;
    pointer-events: none;
}

.icon-exchange {
    text-align: center;
    color: #d1d1d6;
    font-size: 1.2rem;
    margin: -5px 0;
}

.footer-settings {
    margin-top: 30px;
    text-align: center;
}

.adv-btn {
    background: none;
    border: 1px solid #e5e5ea;
    color: #8e8e93;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
}

.hidden-panel {
    display: none;
    margin-top: 15px;
    background: #f2f2f7;
    padding: 15px;
    border-radius: 10px;
}

.hidden-panel input {
    background: white;
    padding: 8px;
}

/* --- 露点温度 Specific Improvements --- */
#tool-露点温度 .controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#tool-露点温度 .row {
    gap: 20px;
    align-items: flex-start;
}

#tool-露点温度 .col {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0f0f5;
}

#tool-露点温度 input {
    font-size: 1.1rem;
    padding: 10px;
    margin-bottom: 8px;
    font-family: "SF Pro Text", -apple-system, sans-serif;
    color: #333;
}

#tool-露点温度 .note {
    font-size: 12px;
    color: #8e8e93;
    margin-top: 4px;
    line-height: 1.4;
}

#tool-露点温度 .highlight-note {
    color: #007aff;
    background: rgba(0, 122, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

#tool-露点温度 .header-source {
    background-color: #fff9ed;
    color: #8a6d3b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid #faebcc;
}