/* Vilaka Lỗ Ban Ruler – CSS v3.1 */

.vilaka-loban-wrapper {
    max-width: 1040px;
    margin: 0 auto;
    padding: 20px 18px 32px;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #222;
}

.vlb-header {
    text-align: center;
    margin-bottom: 18px;
}

.vlb-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0 0 6px;
}

.vlb-subtitle {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* Top row */
.vlb-top-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    margin-bottom: 14px;
}

.vlb-length-panel {
    flex: 1 1 210px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.vlb-length-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.vlb-length-value {
    font-size: 24px;
    font-weight: 700;
}

.vlb-length-value .vlb-unit {
    font-size: 15px;
    margin-left: 4px;
    color: #666;
}

.vlb-length-sub {
    font-size: 12px;
    color: #777;
}

.vlb-input-panel {
    flex: 1 1 240px;
}

.vlb-input-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 3px;
}

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

.vlb-input-mm {
    flex: 1 1 0;
    padding: 5px 9px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.vlb-input-mm:focus {
    outline: none;
    border-color: #ff4b4b;
    box-shadow: 0 0 0 1px rgba(255,75,75,0.25);
}

.vlb-input-apply {
    border: none;
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 13px;
    font-weight: 500;
    background: #ff4b4b;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}

.vlb-input-apply:hover {
    opacity: 0.94;
}

.vlb-input-hint {
    margin: 3px 0 0;
    font-size: 12px;
    color: #888;
}

/* Ruler area */
.vlb-ruler-viewport {
    position: relative;
    width: 100%;
    height: 110px;
    margin: 0 auto 18px;
    border-radius: 10px;
    background: #fafafa;
    border: 1px solid #eee;
    overflow: hidden;
    touch-action: pan-x;
    cursor: grab;
}

.vlb-ruler-viewport.is-dragging {
    cursor: grabbing;
}

.vlb-ruler-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    will-change: transform;
}

.vlb-ruler-scale {
    position: absolute;
    inset: 14px 0 9px 0;
}

/* ticks */
.vlb-tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    background: #ddd;
}

.vlb-tick.small {
    height: 22%;
}

.vlb-tick.medium {
    height: 35%;
    background: #ccc;
}

.vlb-tick.major {
    height: 52%;
    background: #bbb;
}

.vlb-label {
    position: absolute;
    bottom: 56%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

/* Needle */
.vlb-ruler-needle {
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, transparent 0, #ff4b4b 20%, #ff4b4b 80%, transparent 100%);
    pointer-events: none;
}

/* Result cards – mỗi thước 1 row full width */
.vlb-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.vlb-card {
    border-radius: 12px;
    border: 1px solid #eee;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.03);
    padding: 12px 14px 14px;
    box-sizing: border-box;
}

.vlb-card-header {
    margin-bottom: 8px;
}

.vlb-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px;
}

.vlb-card-meta {
    margin: 0;
    font-size: 12px;
    color: #777;
}

.vlb-current-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.vlb-group-badge {
    min-width: 72px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    background: #ffecec;
    color: #c0392b;
}

.vlb-group-badge.is-good {
    background: #ffecec;
    color: #c0392b;
}

.vlb-group-badge.is-bad {
    background: #eef7ff;
    color: #1b4f8a;
}

.vlb-group-text {
    font-size: 13px;
}

.vlb-group-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.vlb-group-note {
    color: #666;
    margin-bottom: 3px;
}

.vlb-group-pos {
    font-size: 12px;
    color: #999;
}

/* Segment bar */
.vlb-group-bar {
    display: flex;
    align-items: stretch;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #fafafa;
}

.vlb-group-segment {
    position: relative;
    flex: var(--vlb-len, 1);
    padding: 5px 4px;
    font-size: 11px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    color: #666;
}

.vlb-group-segment::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.04);
}

.vlb-group-segment:last-child::before {
    display: none;
}

.vlb-group-segment[data-type="good"] {
    background: #e9f8f0;
}
.vlb-group-segment[data-type="bad"] {
    background: #fdecec;
}
.vlb-group-segment[data-type="neutral"] {
    background: #f4f4f4;
}

.vlb-group-segment.is-active {
    outline: 2px solid #ff4b4b;
    outline-offset: -2px;
    z-index: 1;
    font-weight: 600;
}

/* Quick tables */
.vlb-section-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 6px;
}

.vlb-section-intro {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
}

.vlb-quick-section {
    margin-bottom: 24px;
}

.vlb-quick-table {
    margin-bottom: 14px;
}

.vlb-quick-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
}

.vlb-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.vlb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vlb-table th,
.vlb-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.vlb-table thead th {
    background: #fafafa;
    font-weight: 600;
}

.vlb-row-type-good {
    background: #f5fbf7;
}

.vlb-row-type-bad {
    background: #fff6f6;
}

/* Guide / SEO section */
.vlb-guide-section {
    padding: 12px 12px 14px;
    border-radius: 10px;
    background: #fff9e6;
    border: 1px solid #ffe3a4;
}

.vlb-guide-block + .vlb-guide-block {
    margin-top: 8px;
}

.vlb-guide-heading {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
}

.vlb-guide-section p {
    margin: 0;
    font-size: 13px;
    color: #555;
}

.vlb-list {
    margin: 4px 0 0 18px;
    padding: 0;
    font-size: 13px;
    color: #555;
}

.vlb-list-ordered {
    margin-left: 18px;
}

.vlb-list li {
    margin-bottom: 2px;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .vilaka-loban-wrapper {
        padding: 16px 10px 24px;
    }

    .vlb-header {
        margin-bottom: 14px;
    }

    .vlb-top-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 12px;
    }

    .vlb-ruler-viewport {
        height: 100px;
        margin-bottom: 10px;
    }

    .vlb-card {
        padding: 10px 10px 11px;
    }

    .vlb-results {
        gap: 8px;
        margin-bottom: 18px;
    }

    /* Ẩn list cung ở dưới trên mobile cho gọn – chỉ xem tên cung đang chọn ở trên */
    .vlb-group-bar {
        display: none;
    }
}
