/* ===== Bao giờ cưới? — đáp trả khi bị giục lấy chồng ===== */

:root {
  --paper: #FFF6EA;
  --paper-2: #FCE9CF;
  --card: #FFFDF8;
  --ink: #2B1612;
  --ink-soft: #6E4E44;
  --line: #EBD5B8;
  --red: #C4161C;
  --red-deep: #8F0D12;
  --gold: #F4B92E;
  --gold-soft: #FFE6A8;

  /* 3 mức đáp trả */
  --ls: #22704D;  --ls-bg: #DFF2E7;  --ls-ink: #14492F;
  --xs: #A55800;  --xs-bg: #FFE2A6;  --xs-ink: #4A2800;
  --bls: #C4161C; --bls-bg: #C4161C; --bls-ink: #FFFFFF;

  --radius: 20px;
  --shadow: 0 1px 0 rgba(43, 22, 18, .04), 0 14px 30px -14px rgba(143, 13, 18, .22);
  --font-display: "Baloo 2", system-ui, sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 6px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px;
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap { max-width: 1160px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .wrap { padding-inline: 32px; } }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none;
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .15s;
  white-space: nowrap;
}
.btn-sm { padding: 10px 18px; font-size: .95rem; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 5px 0 var(--red-deep); }
.btn-primary:hover { background: #D11C22; }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--red-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #FFC845; }
.btn-outline-light { color: var(--paper); border-color: rgba(255, 246, 234, .5); }
.btn-outline-light:hover { border-color: var(--paper); }

.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--gold-soft); border-color: var(--gold); }
.icon-btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Thanh trên ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; }
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1.55rem; line-height: 1;
  color: var(--red); text-decoration: none; letter-spacing: -.01em;
  display: inline-flex; align-items: center;
}
.brand span {
  display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-left: .18em;
  background: var(--gold); color: var(--red-deep); border-radius: 50%;
  transform: rotate(12deg); font-size: .85em;
}

/* ---------- Hero ---------- */
.hero { display: grid; gap: 40px; align-items: center; padding-block: 16px 64px; }
@media (min-width: 960px) { .hero { grid-template-columns: 1.15fr .85fr; gap: 56px; padding-block: 40px 88px; } }

.countdown {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff; padding: 6px 14px; border-radius: 999px;
  font-weight: 600; font-size: .9rem;
}
.countdown::before { content: "🧧"; }
.countdown b { color: var(--gold); font-size: 1.05em; }

.hero h1 {
  font-weight: 800; font-size: clamp(2.5rem, 7vw, 4.6rem); line-height: 1.08;
  letter-spacing: -.02em; margin: 18px 0;
}
.hl { color: var(--red); background: linear-gradient(transparent 64%, var(--gold-soft) 64%); padding-inline: .05em; }
.lead { font-size: 1.125rem; color: var(--ink-soft); max-width: 34em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* Khung chat minh hoạ */
.chat {
  position: relative; border-radius: 28px; padding: 22px 18px 20px;
  background:
    radial-gradient(rgba(244, 185, 46, .22) 1.6px, transparent 1.8px) 0 0 / 20px 20px,
    linear-gradient(160deg, #CF1A21, var(--red-deep));
  box-shadow: 0 30px 60px -28px rgba(143, 13, 18, .7);
  max-width: 460px; width: 100%; justify-self: center;
}
.chat-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
  color: #fff; font-size: .85rem; font-weight: 600; opacity: .92;
}
.chat-dot { width: 10px; height: 10px; border-radius: 50%; background: #5BE38A; box-shadow: 0 0 0 3px rgba(91, 227, 138, .25); }
.msg { max-width: 86%; margin-bottom: 10px; }
.msg p { padding: 10px 14px; border-radius: 18px; background: #fff; color: var(--ink); font-size: .95rem; line-height: 1.45; }
.msg .who { display: block; margin: 0 0 3px 8px; font-size: .75rem; font-weight: 600; color: var(--gold-soft); }
.msg.in p { border-bottom-left-radius: 6px; width: fit-content; }
.msg.out { margin-left: auto; }
.msg.out p { background: var(--gold); font-weight: 600; border-bottom-right-radius: 6px; }
.sys { margin-top: 14px; text-align: center; font-size: .8rem; font-style: italic; color: #fff; opacity: .85; }
.chat > * { animation: rise .5s ease both; }
.chat > :nth-child(2) { animation-delay: .25s; }
.chat > :nth-child(3) { animation-delay: 1.1s; }
.chat > :nth-child(4) { animation-delay: 2s; }
.chat > :nth-child(5) { animation-delay: 2.8s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Danh sách đáp trả ---------- */
.list { scroll-margin-top: 0; }
.section-title { font-size: clamp(1.8rem, 4.4vw, 2.6rem); font-weight: 800; letter-spacing: -.01em; }
.level-desc { margin-top: 8px; color: var(--ink-soft); min-height: 1.6em; }

.level-bar {
  position: sticky; top: 0; z-index: 5;
  margin-top: 16px; padding-block: 12px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.levels {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  max-width: 560px; padding: 6px; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--line);
}
.level {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 10px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink); font-weight: 700; font-size: .98rem;
  transition: background .2s, color .2s;
}
.level:hover { background: var(--paper-2); }
.lv-emoji { font-size: 1.15em; line-height: 1; }
.level[aria-checked="true"][data-level="lich-su"] { background: var(--ls); color: #fff; }
.level[aria-checked="true"][data-level="xeo-sac"] { background: var(--xs); color: #fff; }
.level[aria-checked="true"][data-level="bat-lich-su"] { background: var(--bls); color: #fff; }
@media (max-width: 480px) {
  .levels { border-radius: 22px; }
  .level { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: .86rem; border-radius: 16px; }
}

.hint { margin-top: 12px; font-size: .88rem; color: var(--ink-soft); }

.cards {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
}
.card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 20px; scroll-margin-top: 110px;
  transition: box-shadow .15s ease, border-color .15s;
}
.card:hover { box-shadow: var(--shadow); border-color: #E2C49C; }
.card:target { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft), var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.num { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1; color: var(--red); }
.acts { display: flex; gap: 6px; }

.said, .reply { display: flex; flex-direction: column; }
.said { align-items: flex-start; }
.reply { align-items: flex-end; }
.lbl {
  margin: 0 10px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-soft); opacity: .8;
}
.said .t, .reply .t { max-width: 92%; padding: 12px 16px; line-height: 1.5; }
.said .t { background: var(--paper-2); border-radius: 18px 18px 18px 6px; color: var(--ink); }
.reply .t { border-radius: 18px 18px 6px 18px; font-weight: 600; font-size: 1.04rem; }
.reply[data-level="lich-su"] .t { background: var(--ls-bg); color: var(--ls-ink); }
.reply[data-level="xeo-sac"] .t { background: var(--xs-bg); color: var(--xs-ink); }
.reply[data-level="bat-lich-su"] .t { background: var(--bls-bg); color: var(--bls-ink); }

/* Chỉ hiện câu đáp của mức đang chọn */
.list[data-level="lich-su"] .reply:not([data-level="lich-su"]),
.list[data-level="xeo-sac"] .reply:not([data-level="xeo-sac"]),
.list[data-level="bat-lich-su"] .reply:not([data-level="bat-lich-su"]) { display: none; }
.list.swap .reply .t { animation: pop .32s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Góp ý ---------- */
.suggest { margin-top: 88px; scroll-margin-top: 16px; }
.suggest-box { background: var(--paper-2); border-radius: 32px; padding: 36px 20px; }
@media (min-width: 768px) { .suggest-box { padding: 44px 48px; } }
.suggest .sub { max-width: 40em; }
.suggest form { margin-top: 20px; max-width: 720px; }
.suggest textarea {
  display: block; width: 100%; min-height: 130px; resize: vertical;
  padding: 14px 16px; border-radius: 18px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; line-height: 1.55;
}
.suggest textarea:focus { outline: none; border-color: var(--ink); }
.suggest textarea::placeholder { color: #A08A80; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.suggest-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.char-count { font-size: .85rem; color: var(--ink-soft); }
.btn:disabled { opacity: .6; cursor: wait; }
.form-msg { margin-top: 12px; min-height: 1.6em; font-weight: 600; }
.form-msg.ok { color: var(--ls); }
.form-msg.err { color: var(--red); }
.privacy { margin-top: 4px; font-size: .85rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-foot { margin-top: 96px; background: var(--ink); color: var(--paper); padding: 48px 0 28px; }
.foot-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.foot-inner p { color: rgba(255, 246, 234, .78); }
.foot-inner .brand-foot { color: var(--paper); margin-bottom: 10px; font-size: 1.7rem; }
.foot-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.foot-note { margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255, 246, 234, .14); font-size: .85rem; color: rgba(255, 246, 234, .6); }

/* ---------- Hộp tạo ảnh ---------- */
dialog.share {
  width: calc(100% - 32px); max-width: 500px; padding: 0; border: 0; border-radius: 24px;
  background: var(--card); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}
dialog.share::backdrop { background: rgba(43, 22, 18, .62); backdrop-filter: blur(3px); }
.share-inner { padding: 16px 18px 18px; }
.share-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.share-head h2 { font-size: 1.4rem; font-weight: 800; }
#shareCanvas {
  display: block; margin-inline: auto; width: auto; height: auto;
  max-width: 100%; max-height: 56vh; border-radius: 14px; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .35);
}
.swatches { display: flex; justify-content: center; gap: 12px; margin: 14px 0; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--line);
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--ink); }
.swatch[data-theme="do"] { background: linear-gradient(135deg, #C9171E, #8F0D12); }
.swatch[data-theme="kem"] { background: linear-gradient(135deg, #FFF8EE, #FBE6C8); }
.swatch[data-theme="dem"] { background: linear-gradient(135deg, #2A1A17, #120A09); }
.share-actions { display: flex; gap: 10px; }
.share-actions .btn { flex: 1; }
.share-note { margin-top: 10px; text-align: center; font-size: .82rem; color: var(--ink-soft); }

/* ---------- Thông báo nhỏ ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
  transition: opacity .2s ease, translate .2s ease; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; translate: -50% 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
