/* Trang giới thiệu Chợ Quê — giấy kem, mực nâu, mái bạt sọc đỏ như trong game.
   Điểm nhấn duy nhất: dải toàn cảnh chợ trôi chầm chậm ở đầu trang. Phần còn lại để yên, gọn. (làm lại 26/10) */
[hidden] { display: none !important; }
:root {
  --paper: #fbf3e2; --paper2: #f4e7c9; --card: #fffaf0; --ink: #3b2a1a; --ink2: #6b5440; --line: #e2d2ae;
  --red: #c8322a; --red-d: #8e1f1a; --cream: #f4e3b0; --green: #3d8b37; --green-d: #2c6b20; --gold: #e2a24a;
  --wood: #8a5a34; --wood-d: #5e3b1f;
  --r: 16px; --shadow: 0 10px 30px rgba(59, 42, 26, .14);
  --display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif; --text: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.65 var(--text); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red-d); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
h2 { font-size: clamp(30px, 4.2vw, 42px); font-weight: 800; }
h3 { font-size: 20px; font-weight: 800; }
p { margin: 0; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(780px, 100% - 32px); }
.muted { color: var(--ink2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* nút: chắc tay như nút trong game */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: 999px; font: 700 16px/1.2 var(--text);
  text-decoration: none; color: var(--ink); background: var(--card); border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s; cursor: pointer; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn:focus-visible, a:focus-visible, summary:focus-visible, .zoom:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-play { background: var(--red); color: #fff8ec; border-color: var(--red-d); box-shadow: 0 4px 0 var(--red-d); }
.btn-play:hover { box-shadow: 0 6px 0 var(--red-d); }
.btn-sm { padding: 8px 16px; font-size: 15px; }
.btn-big { padding: 16px 34px; font-size: 21px; font-family: var(--display); font-weight: 800; box-shadow: 0 6px 0 var(--red-d); }
.btn-big:hover { box-shadow: 0 8px 0 var(--red-d); }

/* thanh trên */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(251, 243, 226, .94); backdrop-filter: blur(8px); border-bottom: 2px solid var(--line); }
.nav-in { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 800 26px/1 var(--display); }
.brand img { border-radius: 10px; }
.menu { display: flex; gap: 4px; margin-left: auto; }
.menu a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 999px; }
.menu a:hover { background: var(--paper2); }

/* mái bạt sọc lượn sóng (giống màn chờ trong game) */
.awning { height: 46px; background: repeating-linear-gradient(90deg, var(--red) 0 44px, #fff3d6 44px 88px); border-radius: 14px 14px 0 0; position: relative; border: 3px solid var(--ink); border-bottom: 0; }
.awning::after { content: ''; position: absolute; left: -3px; right: -3px; bottom: -14px; height: 14px;
  background: radial-gradient(circle at 22px 0, var(--red) 21px, transparent 22px) 0 0 / 88px 14px repeat-x,
              radial-gradient(circle at 66px 0, #fff3d6 21px, transparent 22px) 0 0 / 88px 14px repeat-x; }

/* ---------- đầu trang: toàn cảnh chợ + biển hiệu ---------- */
.hero { position: relative; overflow: hidden; min-height: min(86vh, 760px); display: grid; align-items: center; padding: 56px 0 64px; background: #e9dcc0; border-bottom: 4px solid var(--ink); }
.pano { position: absolute; inset: 0; background: url(assets/cho-toan-canh.webp) 0 70% / auto 112% repeat-x; animation: drift 90s linear infinite; }
.pano::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(251, 243, 226, .2), rgba(251, 243, 226, 0) 30%, rgba(251, 243, 226, 0) 70%, rgba(251, 243, 226, .2)); }
@keyframes drift { from { background-position-x: 0; } to { background-position-x: -3360px; } } /* cả dãy chợ trôi một vòng (ảnh lặp liền) */
.hero-in { position: relative; display: flex; justify-content: center; }
.sign { width: min(620px, 100%); transform: rotate(-2deg); filter: drop-shadow(0 18px 24px rgba(59, 42, 26, .35)); }
.sign-body { background: #fffaf0; border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 18px 18px; padding: 34px 38px 28px; text-align: center; }
.hero h1 { font-size: clamp(64px, 10vw, 120px); font-weight: 800; color: var(--red); letter-spacing: .01em; line-height: .95; text-transform: uppercase;
  text-shadow: 3px 3px 0 var(--ink), 6px 7px 0 rgba(59, 42, 26, .18); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; } /* viền vẽ sau màu chữ: hết vạch trắng chỗ nét chồng nhau (Baloo 2) */
.tagline { font: italic 700 clamp(19px, 2.4vw, 24px)/1.3 var(--display); color: var(--ink); margin-top: 10px; }
.lead { margin: 14px auto 0; font-size: 17px; color: var(--ink2); max-width: 46ch; }
.sign .btn-big { margin-top: 22px; }
.also { margin-top: 14px; font-size: 14px; color: var(--ink2); }

/* ---------- các phần ---------- */
.sec { padding: clamp(56px, 8vw, 96px) 0; }
.sec-alt { background: var(--paper2); border-block: 2px solid var(--line); position: relative; }
.sec-alt::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 10px; background: repeating-linear-gradient(90deg, var(--red) 0 30px, var(--cream) 30px 60px); opacity: .9; }
.sec-lead { color: var(--ink2); max-width: 62ch; margin-top: 10px; font-size: 17px; }

/* một ngày: đường thời gian, các mốc giờ trên một trục */
.rail { list-style: none; padding: 0; margin: 44px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; position: relative; }
.rail::before { content: ''; position: absolute; left: 0; right: 0; top: 17px; border-top: 3px dashed var(--wood); }
.rail li { position: relative; padding-top: 52px; }
.rail .time { position: absolute; top: 0; left: 0; background: var(--ink); color: #fff3d6; font: 800 17px/1 var(--display); padding: 9px 14px 8px; border-radius: 999px; box-shadow: 0 0 0 6px var(--paper); }
.rail h3 { margin-bottom: 6px; }
.rail p { color: var(--ink2); font-size: 15px; }

/* người trong chợ: chân dung vẽ từ game + bong bóng câu cửa miệng */
.people { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.people li { display: grid; justify-items: center; text-align: center; }
.people img { width: 96px; height: 96px; border-radius: 50%; background: #fff3d6; border: 3px solid var(--ink); order: 2; margin-top: 14px; }
.people b { order: 3; margin-top: 8px; font: 800 18px/1.2 var(--display); }
.say { order: 1; position: relative; background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 12px 14px; font-size: 15px; line-height: 1.45; min-height: 92px; display: grid; align-items: center; }
.say::after { content: ''; position: absolute; left: 50%; bottom: -11px; width: 18px; height: 18px; background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg); }

/* có gì: hai biển gỗ cho điều chính, còn lại là danh sách gọn */
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 40px; }
.board { background: var(--wood); color: #fff3d6; border: 3px solid var(--wood-d); border-radius: 12px; padding: 26px 26px 24px; box-shadow: inset 0 0 0 4px rgba(255, 243, 214, .14), 0 6px 0 var(--wood-d);
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 22px); }
.board h3 { font-size: 26px; color: #ffe6a8; }
.board > p { margin-top: 8px; color: #f3e1bd; }
.chat { margin-top: 18px; display: grid; gap: 8px; }
.chat p { max-width: 78%; padding: 8px 13px; border-radius: 14px; font-size: 15px; line-height: 1.4; color: var(--ink); background: #fff; border: 2px solid var(--ink); }
.chat .c { justify-self: start; }
.chat .s { justify-self: end; background: #fff3d6; }
.ladder { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 6px; }
.ladder li { background: #fff3d6; color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 15px; width: calc(52% + var(--i, 0) * 9.6%); }
.ladder li:nth-child(2) { --i: 1; } .ladder li:nth-child(3) { --i: 2; } .ladder li:nth-child(4) { --i: 3; } .ladder li:nth-child(5) { --i: 4; } .ladder li:nth-child(6) { --i: 5; background: #ffe6a8; }
.more { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 32px; }
.more li { padding: 18px 0; border-top: 2px dashed var(--line); }
.more h3 { font-size: 19px; margin-bottom: 4px; }
.more p { color: var(--ink2); font-size: 15px; }

/* hình ảnh */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 40px; }
.gallery figure { margin: 0; }
.zoom { display: block; width: 100%; padding: 0; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; cursor: zoom-in; background: var(--ink); box-shadow: var(--shadow); }
.zoom img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center top; transition: transform .3s; } /* mọi ảnh cùng tỉ lệ: hai cột luôn bằng nhau */
.zoom img.fit { object-fit: contain; object-position: center; background: var(--ink); } /* ảnh điện thoại xoay ngang dài hơn 16:9: hiện trọn, viền tối như máy */
.zoom:hover img { transform: scale(1.03); }
.gallery figcaption { color: var(--ink2); font-size: 15px; margin-top: 10px; font-weight: 500; }

/* tải game */
.dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 40px; align-items: stretch; }
.dl-card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 22px 20px; box-shadow: 0 5px 0 var(--ink); display: flex; flex-direction: column; gap: 12px; }
/* các thẻ cao bằng nhau; tiêu đề, mô tả, nút tải thẳng hàng giữa các thẻ (subgrid: mỗi thẻ chiếm 5 hàng chung) */
@supports (grid-template-rows: subgrid) {
  .dl { grid-template-rows: auto; row-gap: 18px; }
  .dl-card { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 12px; align-content: start; }
  .dl-card > * { margin: 0; }
  .dl-card .steps { grid-row: span 3; } /* iPhone không có nút tải: các bước trải xuống, không đẩy hàng nút của thẻ khác */
}
.dl-card p { font-size: 15px; color: var(--ink2); }
.dl-card .btn { align-self: flex-start; justify-self: start; }
.dl-card.mine { border-color: var(--green-d); box-shadow: 0 5px 0 var(--green-d); outline: 4px solid #3d8b3733; }
.dl-card.mine h3::after { content: 'Máy của bạn'; margin-left: 8px; font: 700 12px/1 var(--text); color: #fff; background: var(--green); padding: 4px 8px; border-radius: 999px; vertical-align: 3px; }
.meta { font-size: 13px !important; }
.note summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink2); }
.note p { margin-top: 6px; font-size: 14px; }
.steps { margin: 0; padding-left: 20px; font-size: 15px; color: var(--ink2); }
.steps li { margin: 3px 0; }
.news { margin: 30px auto 0; background: var(--card); border: 2px dashed var(--ink2); border-radius: var(--r); padding: 18px 22px; }
.news h3 { font-size: 20px; margin-bottom: 6px; }
.news h3 span { font: 500 14px var(--text); color: var(--ink2); }
.news p { white-space: pre-line; color: var(--ink2); }

/* hỏi đáp: danh sách gọn, chỉ có đường kẻ, không đóng hộp */
#hoi-dap details { border-bottom: 2px dashed var(--line); }
#hoi-dap details:first-of-type { margin-top: 26px; border-top: 2px dashed var(--line); }
#hoi-dap summary { cursor: pointer; font-weight: 700; padding: 16px 32px 16px 0; list-style: none; position: relative; }
#hoi-dap summary::-webkit-details-marker { display: none; }
#hoi-dap summary::after { content: '+'; position: absolute; right: 4px; top: 12px; font: 800 24px/1 var(--display); color: var(--red); }
#hoi-dap details[open] summary::after { content: '−'; }
#hoi-dap details p { padding: 0 0 18px; color: var(--ink2); }

/* cuối trang */
.end { background: var(--ink); color: #fff3d6; padding: clamp(48px, 7vw, 80px) 0; }
.end-in { display: flex; align-items: center; gap: 28px; justify-content: center; flex-wrap: wrap; }
.end h2 { color: #f6d58a; }
.fb-link { color: #f3d9a4; font-weight: 600; text-underline-offset: 4px; }
.foot { background: #2c1f13; color: #cdb998; font-size: 14px; padding: 22px 0; }
.foot-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot .muted { color: #b29e7e; }
.foot a { color: #f3d9a4; text-decoration: underline; }

/* ảnh phóng to */
#lightbox { border: 0; padding: 0; background: transparent; max-width: min(1440px, 96vw); }
#lightbox::backdrop { background: rgba(30, 20, 10, .85); }
#lightbox img { border-radius: 12px; border: 3px solid #fff3d6; max-height: 88vh; width: auto; }
.lb-x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card); font-size: 18px; cursor: pointer; }

/* ---------- màn hẹp ---------- */
@media (max-width: 1000px) {
  .dl { grid-template-columns: repeat(2, 1fr); }
  .rail, .people { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
  .rail::before { display: none; }
  .more { grid-template-columns: repeat(2, 1fr); }
  .menu { display: none; }
  .nav .btn-sm { margin-left: auto; }
}
@media (max-width: 760px) {
  .pano { background-image: url(assets/cho-toan-canh-1680.webp); animation-duration: 70s; }
  @keyframes drift { from { background-position-x: 0; } to { background-position-x: -1680px; } }
  .boards { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .end-in { flex-direction: column; text-align: center; }
}
@media (max-width: 560px) {
  /* điện thoại: cảnh chợ thành dải trên cùng, biển hiệu nằm ngay dưới — cảnh chợ luôn có ở màn đầu */
  .hero { min-height: 0; padding: 0 0 28px; display: block; background: var(--paper); border-bottom: 0; }
  .pano { position: relative; height: 230px; inset: auto; background-size: auto 100%; background-position-y: 0; border-bottom: 3px solid var(--ink); }
  .sign { transform: none; margin-top: -26px; filter: drop-shadow(0 10px 16px rgba(59, 42, 26, .25)); }
  .awning { height: 30px; background: repeating-linear-gradient(90deg, var(--red) 0 30px, #fff3d6 30px 60px); }
  .awning::after { height: 10px; bottom: -10px;
    background: radial-gradient(circle at 15px 0, var(--red) 14px, transparent 15px) 0 0 / 60px 10px repeat-x,
                radial-gradient(circle at 45px 0, #fff3d6 14px, transparent 15px) 0 0 / 60px 10px repeat-x; }
  .sign-body { padding: 24px 18px 22px; }
  .tagline { font-size: 17px; }
  .btn-big { width: 100%; }
  .dl, .rail, .people, .more { grid-template-columns: 1fr; }
  .dl-card { display: flex; grid-row: auto; } /* một cột: thẻ co theo nội dung, không giữ hàng trống */
  .people li { grid-template-columns: 72px 1fr; justify-items: start; text-align: left; column-gap: 14px; align-items: center; }
  .people img { width: 72px; height: 72px; order: 0; margin: 0; grid-row: span 2; }
  .people b { order: 0; margin: 0; }
  .say { order: 0; min-height: 0; }
  .say::after { left: -11px; top: 22px; bottom: auto; transform: rotate(135deg); }
  .ladder li { width: calc(40% + var(--i, 0) * 12%); }
  .brand span { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } .pano { animation: none; } }

/* Chỗ bấm trên điện thoại (26/10): vùng bấm ≥ 44px mà không đổi bố cục */
.nav .btn-sm { min-height: 44px; display: inline-flex; align-items: center; }
.note summary { padding: 12px 0; }
/* liên kết nằm trong câu: lề trong suốt trên dưới nới vùng bấm, dòng chữ giữ nguyên */
.also a, .steps a, #hoi-dap p a { padding: 12px 2px; margin: -12px -2px; }
.fb-link { display: inline-block; padding: 12px 4px; }
.ladder li { min-width: max-content; } /* bậc ngắn nhất không bị xuống 2 dòng */
.brand { min-height: 44px; }

/* 📊 thanh hỏi đồng ý đo lượt truy cập (js/do-luong.js) */
.do-bar { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 150; width: min(560px, calc(100vw - 24px));
  background: #fffaf0; color: #3b2a1a; border: 2px solid #3b2a1a; border-radius: 14px; box-shadow: 0 6px 0 rgba(59, 42, 26, .35); padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.do-bar p { margin: 0 0 10px; } .do-bar a { color: #8a3a1a; }
.do-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.do-btns button { min-height: 40px; padding: 6px 16px; border-radius: 10px; border: 2px solid #3b2a1a; background: #fff; color: #3b2a1a; font: inherit; font-weight: 700; cursor: pointer; }
.do-btns .do-yes { background: #3f7a2c; color: #fff; }
