/* Hướng dẫn tân thủ + Sổ khám phá (tour-ui.mjs): cùng phong cách kính tối với social.css (.sws-glass) */
.swg-root { --swg-acc: #34d399; --swg-acc2: #22d3ee; --swg-gold: #fbbf24; --swg-text: #e8eef7; --swg-mute: #93a4bd;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.swg-root * { box-sizing: border-box; }
.swg-root kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; margin: 0 2px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .07)); border: 1px solid rgba(255, 255, 255, .18); border-bottom-width: 2px;
  font: 700 11.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #fff; vertical-align: 1px; }
.swg-btn { height: 40px; padding: 0 18px; border-radius: 12px; border: 0; font: 650 14px/1 inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, filter .15s, background .15s; }
.swg-btn:active { transform: scale(.97); }
.swg-btn-pri { background: linear-gradient(135deg, var(--swg-acc), var(--swg-acc2)); color: #052e2b; box-shadow: 0 10px 24px -10px rgba(45, 212, 191, .8); }
.swg-btn-pri:hover { filter: brightness(1.08); }
.swg-btn-sec { background: rgba(255, 255, 255, .08); color: var(--swg-text); }
.swg-btn-sec:hover { background: rgba(255, 255, 255, .14); }
.swg-btn-sm { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }

/* ---------- màn chào / màn hoàn thành ---------- */
.swg-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto;
  background: radial-gradient(ellipse at center, rgba(6, 30, 40, .35), rgba(2, 6, 18, .7)); backdrop-filter: blur(3px); animation: swg-fade .25s ease-out; }
@keyframes swg-fade { from { opacity: 0; } to { opacity: 1; } }
.swg-dialog { position: relative; width: min(540px, 100%); max-height: calc(100% - 8px); overflow: auto; border-radius: 24px; color: var(--swg-text);
  background: rgba(13, 20, 33, .94); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8); animation: swg-rise .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes swg-rise { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.swg-hero { position: relative; overflow: hidden; padding: 26px 26px 20px; border-radius: 24px 24px 0 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, .35), rgba(14, 165, 233, .28) 60%, rgba(168, 85, 247, .22)); }
.swg-hero::after { content: ''; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%); }
.swg-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(0, 0, 0, .25); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #d1fae5; }
.swg-hero h2 { margin: 12px 0 6px; font-size: 26px; line-height: 1.15; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.swg-hero p { margin: 0; font-size: 14.5px; line-height: 1.55; color: rgba(232, 238, 247, .88); max-width: 420px; }
.swg-globe { position: absolute; right: 22px; top: 20px; font-size: 52px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35)); animation: swg-bob 3.2s ease-in-out infinite; }
@keyframes swg-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.swg-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 22px 4px; }
.swg-tile { padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); }
.swg-tile i { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; font-style: normal; font-size: 19px; margin-bottom: 8px; background: rgba(255, 255, 255, .08); }
.swg-tile b { display: block; font-size: 13.5px; color: #fff; }
.swg-tile span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--swg-mute); }
.swg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 22px 22px; flex-wrap: wrap; }
.swg-foot .swg-note { flex: 1 1 120px; min-width: 0; font-size: 12px; line-height: 1.4; color: var(--swg-mute); }
.swg-chaps { display: flex; gap: 8px; padding: 18px 22px 0; flex-wrap: wrap; }
.swg-chap { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(52, 211, 153, .13); color: #a7f3d0; }
.swg-chap::before { content: '✓'; display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--swg-acc); color: #052e2b; font-size: 11px; font-weight: 900; }
.swg-teaser { margin: 16px 22px 0; padding: 14px; border-radius: 16px; display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, rgba(251, 191, 36, .14), rgba(251, 146, 60, .08)); border: 1px solid rgba(251, 191, 36, .22); }
.swg-teaser i { font-style: normal; font-size: 30px; }
.swg-teaser b { display: block; color: #fde68a; font-size: 14px; }
.swg-teaser span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: rgba(254, 243, 199, .82); }
/* pháo giấy màn hoàn thành */
.swg-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 24px; }
.swg-confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; opacity: 0; animation: swg-drop 2.4s cubic-bezier(.25, .6, .4, 1) forwards; }
@keyframes swg-drop { 0% { opacity: 1; transform: translateY(0) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(420px) rotate(560deg); } }

/* ---------- thẻ nhiệm vụ ---------- */
.swg-card { position: absolute; top: calc(68px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); width: 318px; z-index: 6; pointer-events: auto;
  border-radius: 18px; color: var(--swg-text); background: rgba(13, 20, 33, .9); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 24px 60px -22px rgba(0, 0, 0, .7);
  backdrop-filter: blur(10px); overflow: hidden; transition: opacity .2s, transform .25s; }
.swg-card[hidden] { display: none; }
.swg-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--swg-acc), var(--swg-acc2)); }
.swg-card-hd { display: flex; align-items: center; gap: 8px; padding: 12px 10px 0 14px; }
.swg-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: #6ee7b7; }
.swg-count { margin-left: auto; font: 650 11.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--swg-mute); }
.swg-ic { width: 26px; height: 26px; border: 0; border-radius: 8px; background: none; color: var(--swg-mute); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.swg-ic:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.swg-body { padding: 6px 14px 12px; }
.swg-title { margin: 0; font-size: 17px; font-weight: 750; color: #fff; display: flex; align-items: center; gap: 8px; }
.swg-text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.6; color: rgba(232, 238, 247, .86); }
.swg-meter { margin-top: 10px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.swg-meter[hidden] { display: none; }
.swg-meter b { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--swg-acc), var(--swg-acc2)); transition: width .2s; }
.swg-row { display: flex; align-items: center; gap: 8px; padding: 0 14px 13px; }
.swg-dots { display: flex; gap: 3px; flex: 1; flex-wrap: wrap; min-width: 0; }
.swg-dots i { width: 10px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .14); transition: background .2s, width .2s; }
.swg-dots i.is-done { background: rgba(52, 211, 153, .7); }
.swg-dots i.is-now { width: 18px; background: linear-gradient(90deg, var(--swg-acc), var(--swg-acc2)); }
.swg-skip { border: 0; background: none; color: var(--swg-mute); font-size: 12px; cursor: pointer; padding: 6px 4px; }
.swg-skip:hover { color: #fff; text-decoration: underline; }
.swg-row[hidden] { display: none; }
.swg-ask { flex-wrap: wrap; }
.swg-ask span { flex: 1 1 100%; font-size: 12.5px; color: rgba(232, 238, 247, .85); margin-bottom: 2px; }
.swg-btn-warn { background: rgba(251, 113, 133, .16); color: #fecdd3; }
.swg-btn-warn:hover { background: rgba(251, 113, 133, .26); }
/* xong bước: dải "Tuyệt!" phủ thẻ */
.swg-done { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; font-weight: 800; color: #052e2b;
  background: linear-gradient(135deg, rgba(52, 211, 153, .97), rgba(34, 211, 238, .95)); opacity: 0; pointer-events: none; }
.swg-done.is-on { animation: swg-flash 1.1s ease forwards; }
.swg-done span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #052e2b; color: #6ee7b7; font-size: 16px; }
@keyframes swg-flash { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.swg-card.is-enter { animation: swg-slide .35s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes swg-slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
/* thu nhỏ: viên thuốc */
.swg-pill { position: absolute; top: calc(68px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); z-index: 6; pointer-events: auto;
  height: 36px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(13, 20, 33, .9); color: var(--swg-text);
  display: inline-flex; align-items: center; gap: 8px; font: 650 13px/1 inherit; cursor: pointer; box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .7); }
.swg-pill[hidden] { display: none; }
.swg-pill i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--swg-acc), var(--swg-acc2)); color: #052e2b; font-size: 12px; }
/* nút nổi bật (gợi ý bấm vào nút HUD) */
.swg-glow { animation: swg-glow 1.4s ease-in-out infinite !important; position: relative; z-index: 7; }
@keyframes swg-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .75); } 50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } }

/* ---------- mũi tên chỉ đường (chiếu từ toạ độ 3D, không thêm lần vẽ) ---------- */
.swg-way { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; will-change: transform; }
.swg-way[hidden] { display: none; }
.swg-pin { position: absolute; left: -17px; top: -48px; width: 34px; height: 48px; display: flex; flex-direction: column; align-items: center; animation: swg-hover 1.6s ease-in-out infinite; }
@keyframes swg-hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.swg-pin b { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: linear-gradient(135deg, var(--swg-acc), var(--swg-acc2));
  border: 2px solid #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; }
.swg-pin b::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.swg-ring { position: absolute; left: -16px; top: -6px; width: 32px; height: 12px; border-radius: 50%; border: 2px solid rgba(52, 211, 153, .9); animation: swg-ping 1.6s ease-out infinite; }
@keyframes swg-ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.swg-dist { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); white-space: nowrap; padding: 3px 8px; border-radius: 999px; background: rgba(13, 20, 33, .85); color: #fff;
  font: 700 11.5px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.swg-arrow { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(13, 20, 33, .85); border: 2px solid rgba(52, 211, 153, .9); box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.swg-arrow svg { width: 22px; height: 22px; color: #6ee7b7; }
.swg-way.is-edge .swg-pin, .swg-way.is-edge .swg-ring { display: none; }
.swg-way:not(.is-edge) .swg-arrow { display: none; }
.swg-way.is-edge .swg-dist { top: 26px; }

/* ---------- Sổ khám phá ---------- */
.swg-journal { width: min(640px, 100%); }
.swg-jhd { display: flex; align-items: center; gap: 14px; padding: 20px 22px 14px; }
.swg-jhd h2 { margin: 0; font-size: 20px; font-weight: 800; color: #fff; }
.swg-jhd p { margin: 3px 0 0; font-size: 13px; color: var(--swg-mute); }
.swg-ringbox { position: relative; width: 58px; height: 58px; flex: none; }
.swg-ringbox svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.swg-ringbox b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff; }
.swg-jhd .swg-ic { margin-left: auto; align-self: flex-start; }
.swg-title-badge { margin: 0 22px 12px; padding: 10px 14px; border-radius: 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(254, 243, 199, .9);
  background: linear-gradient(135deg, rgba(251, 191, 36, .16), rgba(251, 146, 60, .08)); border: 1px solid rgba(251, 191, 36, .24); }
.swg-title-badge b { color: #fde68a; }
.swg-title-badge.is-locked { filter: grayscale(.6); opacity: .8; }
.swg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; padding: 0 22px 8px; }
.swg-place { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); }
.swg-place i { flex: none; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 18px; background: rgba(255, 255, 255, .06); filter: grayscale(1); opacity: .55; }
.swg-place b { display: block; font-size: 13px; color: rgba(232, 238, 247, .7); }
.swg-place span { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--swg-mute); }
.swg-place.is-seen { background: rgba(52, 211, 153, .08); border-color: rgba(52, 211, 153, .25); }
.swg-place.is-seen i { filter: none; opacity: 1; background: rgba(52, 211, 153, .16); }
.swg-place.is-seen b { color: #fff; }
.swg-place.is-seen b::after { content: ' ✓'; color: var(--swg-acc); }
.swg-place.is-new { animation: swg-pop 1.2s ease; }
@keyframes swg-pop { 0% { transform: scale(.94); box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); } 40% { transform: scale(1.03); } 100% { transform: none; box-shadow: 0 0 0 14px rgba(52, 211, 153, 0); } }
/* thông báo ghé địa danh mới */
.swg-found { position: absolute; left: 50%; top: calc(76px + env(safe-area-inset-top, 0px)); z-index: 8; transform: translateX(-50%); pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 12px; border-radius: 16px; color: #fff; background: rgba(13, 20, 33, .92);
  border: 1px solid rgba(52, 211, 153, .35); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7); animation: swg-found 3.6s ease forwards; }
.swg-found i { font-style: normal; font-size: 26px; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(52, 211, 153, .16); }
.swg-found small { display: block; font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: #6ee7b7; }
.swg-found b { display: block; font-size: 15px; }
.swg-found.is-gold { border-color: rgba(251, 191, 36, .5); }
.swg-found.is-gold small { color: #fde68a; }
@keyframes swg-found { 0% { opacity: 0; transform: translate(-50%, -10px) scale(.96); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }

/* điện thoại / màn hình hẹp */
@media (max-width: 640px) {
  .swg-tiles { grid-template-columns: 1fr; }
  .swg-tile { display: flex; gap: 10px; align-items: center; padding: 10px; }
  .swg-tile i { margin: 0; flex: none; }
  .swg-hero h2 { font-size: 22px; padding-right: 54px; }
  .swg-globe { font-size: 40px; }
}
/* màn hình thấp (điện thoại nằm ngang): hộp thoại gọn, ô giới thiệu chỉ còn tiêu đề */
@media (max-height: 520px) {
  .swg-modal { padding: 8px; }
  .swg-hero { padding: 14px 18px 12px; }
  .swg-hero h2 { margin: 6px 0 4px; font-size: 20px; }
  .swg-hero h2 br { display: none; }
  .swg-hero p { font-size: 13px; line-height: 1.45; }
  .swg-globe { font-size: 34px; top: 12px; right: 16px; }
  .swg-tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 18px 0; }
  .swg-tile { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
  .swg-tile i { width: 28px; height: 28px; font-size: 16px; margin: 0; flex: none; }
  .swg-tile span { display: none; }
  .swg-foot { padding: 12px 18px 14px; }
  .swg-chaps { padding: 10px 18px 0; }
  .swg-teaser { margin: 10px 18px 0; padding: 10px 12px; }
  .swg-jhd { padding: 14px 18px 10px; }
  .swg-grid { padding: 0 18px 6px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .swg-place span { display: none; }
}
.sw-touch .swg-card, .sw-touch .swg-pill { top: auto; bottom: auto; top: calc(58px + env(safe-area-inset-top, 0px)); right: 50%; transform: translateX(50%); width: min(340px, calc(100vw - 150px)); }
.sw-touch .swg-pill { width: auto; }
.sw-touch .swg-text { font-size: 12.5px; line-height: 1.5; }
.sw-touch .swg-card .swg-body { padding-bottom: 8px; }
.sw-guiding #sw-help { display: none; }
.sw-focus .swg-card, .sw-focus .swg-pill, .sw-focus .swg-way { display: none; }
