/* Giao diện dùng chung của bộ khung (nút về làng, bảng cuối ván, thông báo). Mọi lớp đều có tiền tố lg-. */
:root {
  --lg-do: #c8302a; --lg-do-dam: #8f1d18; --lg-vang: #ffcf4a; --lg-giay: #fff7e6; --lg-muc: #3a2314;
  --lg-muc-nhat: #7a5a42; --lg-vien: #e9d3a8; --lg-bong: 0 10px 30px rgba(40, 15, 0, .28);
  --lg-font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.lg-man, .lg-man *, .lg-toasts, .lg-toast, .lg-nut-ve { box-sizing: border-box; }
.lg-nut-ve {
  position: fixed; z-index: 9000; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; padding: 0;
  background: var(--lg-giay); color: var(--lg-do-dam); border: 2.5px solid var(--lg-vang);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35); -webkit-tap-highlight-color: transparent;
}
.lg-nut-ve:active { transform: scale(.92); }
.lg-nut-ve[hidden] { display: none; }
.lg-tren-trai { top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); }
.lg-tren-phai { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
.lg-duoi-trai { bottom: calc(10px + env(safe-area-inset-bottom)); left: calc(10px + env(safe-area-inset-left)); }
.lg-duoi-phai { bottom: calc(10px + env(safe-area-inset-bottom)); right: calc(10px + env(safe-area-inset-right)); }

.lg-toasts {
  position: fixed; z-index: 9500; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.lg-toast {
  font: 700 15px/1.35 var(--lg-font); color: var(--lg-muc); background: var(--lg-giay);
  border: 2px solid var(--lg-vang); border-radius: 14px; padding: 9px 16px; box-shadow: var(--lg-bong);
  display: flex; align-items: center; gap: 8px; animation: lg-vao .3s ease-out; text-align: center;
}
.lg-toast.lg-an { opacity: 0; transform: translateY(-8px); transition: .35s; }
@keyframes lg-vao { from { opacity: 0; transform: translateY(-10px) scale(.96); } }

.lg-man {
  position: fixed; inset: 0; z-index: 9200; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 8, 2, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  overflow-y: auto; animation: lg-mo .25s ease-out;
}
@keyframes lg-mo { from { opacity: 0; } }
.lg-the {
  font-family: var(--lg-font); color: var(--lg-muc); background: var(--lg-giay);
  border-radius: 22px; border: 3px solid var(--lg-vang); box-shadow: var(--lg-bong), inset 0 0 0 5px #fff1d0;
  width: min(380px, 100%); padding: 22px 20px 18px; text-align: center; position: relative;
  animation: lg-nay .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes lg-nay { from { transform: scale(.85); opacity: 0; } }
.lg-kt-game { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--lg-do); }
.lg-the h2 { margin: 2px 0 8px; font-size: 26px; font-weight: 900; }
.lg-kt-diem { font-size: 52px; font-weight: 900; line-height: 1; color: var(--lg-do-dam); }
.lg-kt-diem span { font-size: 16px; font-weight: 700; margin-left: 6px; color: var(--lg-muc-nhat); }
.lg-kt-kyluc {
  display: inline-block; margin-top: 10px; padding: 4px 14px; border-radius: 99px; font-weight: 800;
  background: linear-gradient(#ffe27a, #ffbe2e); color: #6b3a00; animation: lg-lac 1.2s ease-in-out infinite;
}
@keyframes lg-lac { 50% { transform: rotate(-3deg) scale(1.06); } }
.lg-kt-phu { margin-top: 8px; font-size: 14px; color: var(--lg-muc-nhat); }
.lg-kt-loc {
  margin: 14px auto 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px;
  background: #ffe9e3; color: var(--lg-do-dam); border-radius: 12px; padding: 6px 14px;
}
.lg-kt-loc small { font-weight: 600; color: var(--lg-muc-nhat); font-size: 13px; }
.lg-kt-clip {
  display: block; position: relative; width: 120px; margin: 14px auto 0; padding: 0; border: 0; border-radius: 12px;
  overflow: hidden; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); background: #000;
}
.lg-kt-clip img { display: block; width: 100%; aspect-ratio: 9/16; object-fit: cover; }
.lg-kt-clip span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 4px; font: 800 12px var(--lg-font); color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8)); display: flex; align-items: center; justify-content: center; gap: 4px;
}
.lg-kt-nut { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.lg-btn {
  font: 800 15px var(--lg-font); color: var(--lg-muc); background: #fff; border: 2px solid var(--lg-vien);
  border-radius: 14px; padding: 11px 14px; min-height: 46px; cursor: pointer; display: inline-flex; align-items: center;
  gap: 6px; -webkit-tap-highlight-color: transparent; text-decoration: none;
}
.lg-btn:active { transform: translateY(2px); }
.lg-btn.lg-chinh {
  flex-basis: 100%; justify-content: center; font-size: 18px; color: #fff; border: 0;
  background: linear-gradient(#e2463d, var(--lg-do-dam)); box-shadow: 0 4px 0 #5e100c;
}
.lg-btn.lg-chinh:active { box-shadow: 0 1px 0 #5e100c; }
.lg-btn:focus-visible, .lg-nut-ve:focus-visible, .lg-goi-y:focus-visible { outline: 3px solid #2b7bd9; outline-offset: 2px; }
.lg-goi-y {
  display: grid; gap: 2px; margin-top: 16px; padding: 12px 14px; border-radius: 14px; text-align: left; text-decoration: none;
  color: var(--lg-muc); background: #fff3d6; border: 2px dashed #e5b955;
}
.lg-goi-y-nhan { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--lg-do); }
.lg-goi-y b { font-size: 17px; }
.lg-goi-y small { font-size: 13px; color: var(--lg-muc-nhat); }
.lg-hinh { display: block; border-radius: 50%; flex: none; }
.lg-icon-loc { display: inline-block; vertical-align: middle; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .lg-the, .lg-man, .lg-toast, .lg-kt-kyluc { animation: none; }
}

/* ô "chơi game khác" gắn vào màn kết thúc riêng của game */
.lg-o-goi-y { font-family: var(--lg-font); display: grid; gap: 8px; width: min(360px, 100%); margin: 14px auto 0; text-align: left; }
.lg-o-goi-y .lg-goi-y { margin-top: 0; }
.lg-o-goi-y .lg-ve-lang { justify-content: center; width: 100%; }

/* bài giới thiệu + cách chơi (mở từ bảng cuối ván) */
.lg-lien-ket { display: block; margin: 12px auto 0; padding: 8px; background: none; border: 0; cursor: pointer; font: 700 14px var(--lg-font); color: var(--lg-muc-nhat); text-decoration: underline; }
.lg-man-gt { z-index: 9300; place-items: start center; }
.lg-bai { text-align: left; width: min(520px, 100%); font-size: 15px; line-height: 1.5; }
.lg-bai h1 { margin: 0 40px 8px 0; font-size: 24px; font-weight: 900; color: var(--lg-do-dam); }
.lg-bai h2 { font-size: 17px; margin: 16px 0 6px; text-align: left; }
.lg-bai p { margin: 0 0 8px; }
.lg-bai ol, .lg-bai ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.lg-bai a { color: var(--lg-do); font-weight: 700; }
.lg-dong { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f1e2c4; color: var(--lg-muc); font-size: 22px; cursor: pointer; }
.lg-kt-hang { margin-top: 10px; font-weight: 800; font-size: 15px; color: #2f6f3a; }
.lg-kt-hang[hidden] { display: none; }
.lg-kt-tt { margin: 10px auto 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; background: linear-gradient(#ffe27a, #ffbe2e); color: #6b3a00; border-radius: 12px; padding: 6px 12px; }
.lg-kt-thach { margin-top: 10px; font-weight: 800; font-size: 15px; color: var(--lg-muc-nhat); }
.lg-kt-thach.thang { color: #2f6f3a; }
.lg-toast b { color: var(--lg-do-dam); }

/* huy chương + nhiệm vụ trên bảng cuối ván */
.lg-kt-hc { margin: 12px auto 0; max-width: 300px; }
.lg-hc-day { display: flex; justify-content: center; gap: 14px; }
.lg-hc { display: grid; justify-items: center; gap: 2px; opacity: .38; filter: grayscale(.9); }
.lg-hc i { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8, transparent 45%), var(--mau); border: 2.5px solid color-mix(in srgb, var(--mau) 60%, #3a2412); box-shadow: inset 0 -3px 0 #0002, 0 2px 0 #0002; }
.lg-hc small { font-size: 10.5px; font-weight: 700; color: var(--lg-muc-nhat); }
.lg-hc.dat { opacity: 1; filter: none; }
.lg-hc.moi i { animation: lg-hc-nay .9s cubic-bezier(.2, 1.6, .4, 1) .25s both; }
@keyframes lg-hc-nay { 0% { transform: scale(.2) rotate(-40deg); } 60% { transform: scale(1.45); box-shadow: 0 0 0 8px #ffe27a88; } 100% { transform: none; } }
.lg-hc-thanh { height: 9px; margin-top: 8px; border-radius: 6px; background: #eadfc8; overflow: hidden; }
.lg-hc-thanh b { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ffbe2e, #e5533d); }
.lg-hc-chu { margin-top: 5px; font-size: 13.5px; font-weight: 600; color: var(--lg-muc-nhat); }
.lg-hc-chu b { color: var(--lg-do-dam); }
.lg-hc-chu.moi { font-weight: 800; font-size: 15px; color: #8a5a00; display: flex; gap: 5px; justify-content: center; align-items: center; }
.lg-kt-suyt { margin-top: 8px; font-size: 15px; font-weight: 800; color: var(--lg-do); }
.lg-kt-nv { margin-top: 9px; font-size: 13px; color: var(--lg-muc-nhat); }
.lg-kt-nv b { color: var(--lg-muc); }
@media (prefers-reduced-motion: reduce) { .lg-hc.moi i { animation: none; } }
