/* ============================================
   WORLD.CSS — Trang "Lịch sử Việt Nam & Thế giới" (world.html)
   Dùng biến màu của styles.css nên tự đổi theo chế độ sáng/tối.
   ============================================ */
.world-view { position: relative; z-index: 2; width: 100%; max-width: none; margin: 0; padding: var(--sp-md) 16px 56px; }
.w-layout { display: block; }
.w-left, .w-right { min-width: 0; }
.w-lead-wrap { position: relative; margin: 0 0 14px; max-width: 1024px; }
.world-lead { font-size: 15px; color: var(--text-muted); margin: 0; max-width: 1024px; cursor: pointer; display: inline-block; }
.world-lead:hover, .world-lead[aria-expanded="true"] { color: var(--text); }
/* Hộp hướng dẫn mở ra khi bấm câu giới thiệu */
.w-tip { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: min(460px, calc(100vw - 32px)); background: var(--bg-white); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 12px 14px; }
.w-tip[hidden] { display: none; }
.w-tip::before { content: ''; position: absolute; top: -6px; left: 22px; width: 10px; height: 10px; background: var(--bg-white); border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); transform: rotate(45deg); }
.world-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.w-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding-bottom: 2px; }
.w-chips::-webkit-scrollbar { display: none; }
.w-chip, .w-btn { font: 13px/1 inherit; font-family: inherit; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg-white); color: var(--text); white-space: nowrap; }
.w-chip:hover, .w-btn:hover { border-color: var(--red); color: var(--red); }
.w-btn { display: inline-flex; align-items: center; gap: 6px; }
.w-chips { order: 3; flex-basis: 100%; }
.w-zoom { margin-left: auto; }
.w-zoom { display: flex; gap: 4px; align-items: center; font-size: 12px; color: var(--text-muted); }
.w-pct { min-width: 44px; text-align: center; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.w-zoom button { width: 32px; height: 32px; border: 1px solid var(--border-strong); background: var(--bg-white); color: var(--text); border-radius: 6px; font-size: 17px; line-height: 1; }
.w-zoom button:hover { border-color: var(--red); color: var(--red); }

/* Ô chọn nền văn minh */
.w-picker { position: relative; }
.w-panel { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: 320px; max-height: 70vh; overflow-y: auto; background: var(--bg-white); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 10px 12px 12px; display: none; }
.w-panel.open { display: block; }
.w-panel h4 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin: 10px 0 4px; font-weight: 600; }
.w-panel h4:first-child { margin-top: 2px; }
.w-opt { display: flex; align-items: center; gap: 9px; padding: 6px 4px; font-size: 14px; cursor: pointer; border-radius: 6px; }
.w-opt:hover { background: var(--hover-tint); }
.w-opt input { accent-color: var(--red); width: 16px; height: 16px; flex-shrink: 0; }
.w-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.w-opt small { color: var(--text-faint); font-size: 12px; margin-left: auto; }
.w-panel-tools { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.w-panel-tools button { font-size: 12px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg-white); color: var(--text); }
.w-panel-tools button:hover { border-color: var(--red); color: var(--red); }

/* Dòng thời gian */
.w-scroller { overflow-x: auto; border: 1px solid var(--border-mid); border-radius: 10px; background: var(--bg-white); position: relative; -webkit-overflow-scrolling: touch; }
.w-inner { position: relative; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.w-ruler { height: 30px; position: relative; border-bottom: 1px solid var(--border-mid); margin-left: 104px; font-size: 11px; color: var(--text-muted); }
.w-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); padding: 8px 0 0 4px; white-space: nowrap; }
.w-tick.major { border-left-color: var(--border-strong); color: var(--text); }
.w-zero { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--text-faint); padding: 8px 0 0 4px; font-weight: 600; font-size: 11px; color: var(--text); white-space: nowrap; }
.w-lane { display: flex; height: 50px; border-bottom: 1px solid var(--border); position: relative; }
.w-lane.vn { background: rgba(192,15,12,.06); height: 58px; }
.w-lane { transition: background-color .15s ease; }
.w-lane.hl, .w-lane.hl .w-lane:not(.vn) .w-lbl { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.w-lane.dragging { z-index: 8; background: var(--hover-tint); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
body.w-dragging, body.w-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.w-lbl { background-color: var(--hover-tint); }
.w-lane.vn.hl { background-color: rgba(192,15,12,.16); }
.w-lane.hl .w-seg { opacity: 1; }
.w-lbl { position: sticky; left: 0; z-index: 3; width: 104px; flex-shrink: 0; display: flex; align-items: center; gap: 7px; padding: 0 8px; font-weight: 600; font-size: 12px; line-height: 1.25; background: var(--bg-white); border-right: 1px solid var(--border-mid); }
.w-lane.vn .w-lbl { background: var(--bg-white); box-shadow: inset 0 0 0 100px rgba(192,15,12,.06); }
.w-track { position: relative; flex: 1; }
.w-seg { position: absolute; top: 8px; bottom: 8px; border-radius: 6px; color: #fff; font-size: 11px; line-height: 1.2; padding: 5px 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: .92; border: 1px solid var(--bg-white); }
/* Các giai đoạn liền kề trong cùng một hàng xen kẽ đậm / nhạt để dễ phân biệt */
.w-seg { isolation: isolate; }
.w-seg::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; pointer-events: none; }
.w-seg:nth-child(odd)::before { background: rgba(255,255,255,0.1); }
.w-seg:nth-child(even)::before { background: rgba(0,0,0,0.1); }
.w-lane.vn .w-seg { top: 9px; bottom: 9px; font-size: 12px; }
.w-pins { position: relative; height: 26px; margin-left: 104px; border-top: 1px solid var(--border-mid); }
.w-pin { position: absolute; top: 6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg-white); box-shadow: 0 0 0 1px var(--text); cursor: pointer; }
.w-cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--red); z-index: 5; pointer-events: none; }
.w-cursor b { position: absolute; top: 2px; left: 4px; background: var(--red-bg); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.w-cursor.lock b::after { content: ' (đã ghim)'; font-weight: 400; }

/* Thanh năm + thanh trượt */
.w-slider { display: flex; align-items: center; gap: 12px; margin: 24px 12px; position: sticky; top: 0; z-index: 10; background: var(--bg-white);  }
.w-slider input { flex: 1; accent-color: var(--red); min-width: 0; }
.w-yr { font-size: 22px; font-weight: 600; min-width: 138px; }
.w-yr::before { content: 'Năm '; font-size: 22px; font-weight: 400; color: var(--text-muted); margin-right: 2px; }
/* Biểu tượng info trước câu hướng dẫn (đổi màu theo chữ, tự đổi theo giao diện sáng/tối) */
.world-lead::before { content: ''; display: inline-block; width: 1.15em; height: 1.15em; margin-right: 7px; vertical-align: -0.2em; background-color: currentColor; opacity: .75;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat; }
.w-hint { font-size: 13.5px; line-height: 1.6; color: var(--text-body); margin: 0; }

/* Thẻ thông tin từng nền văn minh */
.w-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.w-card { border: 1px solid var(--border-mid); border-top: 4px solid var(--c); border-radius: 8px; padding: 10px 12px 12px; background: var(--bg-white); }
.w-card.vn { grid-column: 1 / -1; border-top-color: var(--red); }
.w-card h3 { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; margin: 0 0 4px; color: var(--c); font-weight: 600; }
.w-card .t { font-size: 17px; font-weight: 500; margin: 0; line-height: 1.3; }
.w-card .y { font-size: 12px; color: var(--text-muted); margin: 2px 0 6px; }
.w-card p.d { font-size: 14px; line-height: 1.55; margin: 0; color: var(--text-body); }
.w-card { transition: box-shadow .15s ease, transform .15s ease; }
.w-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.12); }
html[data-theme="dark"] .w-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.6); }
.w-card.none { opacity: .6; }
.w-card.vn.none { opacity: 1; }
.w-card.none .t { font-size: 14px; color: var(--text-muted); }
.w-ev { margin-top: 14px; font-size: 13.5px; color: var(--text-body); }
.w-note { margin-top: 28px; font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border-mid); padding-top: 14px; }
.w-note ul { margin: 6px 0 0; padding-left: 18px; }
.w-note a { color: var(--red); }

@media (min-width: 769px) {
    .w-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: stretch; }
    /* Cột phải cao đúng bằng cột trái (không tự kéo dài), thẻ dài hơn thì cuộn trong cột */
    .w-right { position: relative; min-height: 320px; }
    .w-right-in { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow-y: auto; padding: 12px 12px 18px 4px; margin: 0 -12px 0 -4px; }
    .w-cards { grid-template-columns: 1fr; }
    .w-slider { top: 0; }
}

@media (max-width: 768px) {
    .world-view { padding: var(--sp-sm) var(--sp-md) 40px; }
    .w-lbl { width: 82px; font-size: 11px; padding: 0 6px; }
    .w-ruler, .w-pins { margin-left: 82px; }
    .w-lane { height: 44px; }
    .w-lane.vn { height: 50px; }
    .w-yr { font-size: 19px; min-width: 116px; }
    .w-card.vn { grid-column: auto; }
    .w-panel { width: min(320px, calc(100vw - 32px)); }
    .w-zoom .w-zl { display: none; }
}
