* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', '微軟正黑體', Arial, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.container {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 32px;
    padding: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    max-width: 420px;
    width: 100%;
}

/* ── Header ───────────────────────────────────────────── */

h1 {
    color: #2c3e50;
    text-align: center;
    font-size: 1.4em;
    margin-bottom: 2px;
}

.subtitle {
    text-align: center;
    color: #7f8c8d;
    font-size: 0.8em;
    margin-bottom: 12px;
}

/* ── Taiwan standard ──────────────────────────────────── */

.taiwan-standard {
    background: #e8f5e8;
    border: 1.5px solid #27ae60;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.taiwan-standard h3 {
    color: #27ae60;
    font-size: 0.78em;
    margin-bottom: 6px;
}

.vision-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.vision-scale span {
    background: white;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.72em;
    flex: 1 1 45%;
}

/* ── Controls ─────────────────────────────────────────── */

.controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 12px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group.text-input {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 2px;
}

label {
    color: #2c3e50;
    font-weight: bold;
    font-size: 0.78em;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 76px;
    flex-shrink: 0;
}

.text-input label {
    min-width: unset;
}

.icon {
    font-size: 1em;
}

/* ── Range sliders ────────────────────────────────────── */

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ── Text input ───────────────────────────────────────── */

input[type="text"] {
    padding: 8px 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    border-color: #3498db;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.value-display {
    color: #e74c3c;
    font-weight: bold;
    font-size: 0.72em;
    text-align: center;
    background: white;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1.5px solid #e74c3c;
    min-width: 82px;
    flex-shrink: 0;
}

/* ── Condition selector ───────────────────────────────── */

.condition-selector {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: center;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

.condition-btn {
    background: #ecf0f1;
    color: #2c3e50;
    border: 1.5px solid #bdc3c7;
    padding: 5px 10px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.78em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.condition-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

/* ── Viewport ─────────────────────────────────────────── */

.viewport {
    background: #fff;
    border: 2px solid #34495e;
    border-radius: 12px;
    padding: 12px 16px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.text-display {
    color: #2c3e50;
    font-size: 2.4em;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    z-index: 2;
}

.vision-chart {
    position: absolute;
    top: 6px;
    right: 8px;
    background: rgba(255, 255, 255, 0.92);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.68em;
    color: #2c3e50;
    border: 1px solid #ddd;
    line-height: 1.5;
}

.vision-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

/* ── Info panel ───────────────────────────────────────── */

.info-panel {
    background: #34495e;
    color: white;
    border-radius: 14px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.info-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
}

.info-title {
    font-weight: bold;
    margin-bottom: 6px;
    color: #3498db;
    font-size: 0.8em;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    font-size: 0.75em;
}

/* ── Reset button ─────────────────────────────────────── */

.reset-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 4px;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding: 8px;
    }

    .container {
        border-radius: 20px;
        padding: 14px;
    }

    .info-panel {
        grid-template-columns: 1fr;
    }
}
