.floating-card {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 320px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 12px 24px -4px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    overflow: hidden;
    z-index: 100;
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.floating-card:hover {
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.08),
        0 20px 40px -4px rgba(0, 0, 0, 0.12),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.92);
}

.tabs-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0;
    position: relative;
}

.tab-btn {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
    z-index: 2;
}

.tab-btn:hover {
    color: #111;
    background: rgba(0, 0, 0, 0.02);
}

.tab-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5px;
}

input[name="tabs"] {
    display: none;
}

#tab-lens:checked ~ .tabs-header label[for="tab-lens"],
#tab-image:checked ~ .tabs-header label[for="tab-image"],
#tab-rays:checked ~ .tabs-header label[for="tab-rays"] {
    color: #007aff;
    background: transparent;
}

.tab-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 33.333%;
    background: #007aff;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px 3px 0 0;
    z-index: 3;
}

#tab-lens:checked ~ .tabs-header .tab-indicator {
    transform: translateX(0%);
}

#tab-image:checked ~ .tabs-header .tab-indicator {
    transform: translateX(100%);
}

#tab-rays:checked ~ .tabs-header .tab-indicator {
    transform: translateX(200%);
}

.tabs-content {
    position: relative;
    min-height: 260px;
}

.content-section {
    display: none;
    padding: 20px;
    animation: lensesFadeIn 0.18s ease-out;
}

@keyframes lensesFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

#tab-lens:checked ~ .tabs-content .section-lens {
    display: block;
}

#tab-image:checked ~ .tabs-content .section-image {
    display: block;
}

#tab-rays:checked ~ .tabs-content .section-rays {
    display: block;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    margin-bottom: 8px;
}

.hint {
    margin-top: 8px;
    font-size: 12px;
    color: #777;
    line-height: 1.4;
    font-style: italic;
    background: rgba(255, 240, 0, 0.1);
    padding: 8px 10px;
    border-radius: 8px;
    border-left: 3px solid #ffd700;
}

.kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.kv:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.kv span:first-child {
    color: #666;
    font-weight: 500;
}

.kv span:last-child {
    color: #111;
    font-weight: 600;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 13px;
    background: rgba(0,0,0,0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    background: rgba(0,0,0,0.02);
    padding: 12px;
    border-radius: 12px;
}

.stat-label {
    color: #666;
    font-weight: 600;
}

select {
    width: 100%;
    background-color: rgba(255,255,255,0.8);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-weight: 500;
    color: #333;
    height: 40px;
    padding: 0 12px;
    transition: all 0.2s;
    outline: none;
}

select:hover {
    border-color: rgba(0,0,0,0.2);
    background-color: #fff;
}

select:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 99px;
    margin: 10px 0;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 2px solid #007aff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    cursor: grab;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

.control-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    text-transform: none;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    padding: 6px 0;
    transition: opacity 0.2s;
}

.control-group label:has(input[type="checkbox"]):hover {
    opacity: 0.8;
}

input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: #007aff;
}

@media (max-width: 768px) {
    #simulation-container {
        --controls-h: 38vh;
    }

    #lensCanvas {
        height: calc(100% - var(--controls-h));
        min-height: 260px;
    }

    .floating-card {
        top: auto;
        left: 0;
        bottom: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        border: none;
        border-top: 1px solid rgba(255,255,255,0.6);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        max-height: var(--controls-h);
        overflow-y: auto;
    }

    .tabs-content {
        min-height: auto;
        padding-bottom: 20px;
    }

    .tab-btn {
        padding: 14px 0;
    }

    #reset-btn {
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 20px;
        bottom: calc(var(--controls-h) + 16px);
        transition: bottom 0.3s ease;
    }
}

