/* ===== Đại gia đình — style chung ===== */
:root {
  --kem: #FAF5E5;
  --kem-dam: #F1E4C8;
  --vien: #E3CFA8;
  --nau: #6B3E26;
  --nau-dam: #3B2314;
  --chu: #4A2C1A;
  --chu-phu: #5C3A24;
  --go: #8B5A3C;
  --hong: #E8789A;
  --hong-nhat: #FBE3EA;
  --hong-dam: #A3324F;
  --cam-film: #FF8A3D;
  --vang: #F2C48D;
  --font-tieu-de: 'Baloo 2', system-ui, sans-serif;
  --font-chu: 'Be Vietnam Pro', system-ui, sans-serif;
  --font-tay: 'Patrick Hand', cursive;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--kem);
  color: var(--chu);
  font-family: var(--font-chu);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--go); }
a:hover { color: var(--nau); }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--hong); outline-offset: 3px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Thanh điều hướng ===== */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 245, 229, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 2px dashed var(--vien);
}
.nav .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--nau); }
.brand img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--nau); background: #fff; object-fit: cover; }
.brand span { font-family: var(--font-tieu-de); font-weight: 800; font-size: 24px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  padding: 10px 16px; border-radius: 999px; color: var(--nau);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.nav-links a:hover { background: var(--kem-dam); }
.nav-links a.active { background: var(--nau); color: var(--kem); }
.music-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--nau);
  background: #fff; color: var(--nau); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.music-btn.playing { background: var(--nau); color: var(--kem); }
.music-btn.playing svg { animation: lac 1.2s ease-in-out infinite; }
@keyframes lac { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* ===== Nút ===== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px; border-radius: 16px;
  font-weight: 700; font-size: 17px; text-decoration: none;
  border: 3px solid var(--nau-dam); box-shadow: 0 4px 0 var(--nau-dam);
  transition: transform .15s, box-shadow .15s; cursor: pointer;
}
.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--nau-dam); }
.btn-discord { background: #5865F2; color: #fff; }
.btn-discord:hover { color: #fff; }
.btn-trang { background: #fff; color: var(--nau); }
.btn-nau { background: var(--nau); color: var(--kem); border-color: var(--nau); box-shadow: none; border-radius: 999px; font-size: 15px; padding: 12px 20px; }
.btn-nau:hover { color: var(--kem); background: var(--nau-dam); box-shadow: none; transform: none; }
.pill-online {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px;
  background: #E4F3E6; color: #23633A; font-weight: 600; font-size: 15px;
}
.pill-online .dot { width: 10px; height: 10px; border-radius: 50%; background: #2E9E57; box-shadow: 0 0 0 0 rgba(46,158,87,.5); animation: nhip 2s infinite; }
@keyframes nhip { 70% { box-shadow: 0 0 0 8px rgba(46,158,87,0); } 100% { box-shadow: 0 0 0 0 rgba(46,158,87,0); } }

/* ===== Trang chủ ===== */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-top: 64px; padding-bottom: 48px; }
.hero-text { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.tag { align-self: flex-start; padding: 6px 14px; border-radius: 999px; background: var(--hong-nhat); color: var(--hong-dam); font-weight: 600; font-size: 14px; }
.hero h1 { margin: 0; font-family: var(--font-tieu-de); font-weight: 800; font-size: clamp(56px, 9vw, 88px); line-height: .95; color: var(--nau); }
.hero p { margin: 0; font-size: 19px; line-height: 1.6; color: var(--chu-phu); max-width: 480px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-photo { flex: 0 1 360px; display: flex; justify-content: center; margin: 0 auto; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding-bottom: 56px; }
.card { background: #fff; border: 3px solid var(--nau-dam); border-radius: 24px; padding: 24px; }
.card h3 { margin: 0 0 6px; font-family: var(--font-tieu-de); font-weight: 800; font-size: 22px; color: var(--nau); }
.card p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--chu-phu); }

.band { background: var(--kem-dam); border-top: 2px dashed #D9BF8E; border-bottom: 2px dashed #D9BF8E; }
.band .wrap { padding-top: 56px; padding-bottom: 64px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 32px; }
.section-head .kicker { display: block; font-family: var(--font-tay); font-size: 22px; color: var(--hong-dam); }
.section-head h2, .h2 { margin: 0; font-family: var(--font-tieu-de); font-weight: 800; font-size: clamp(34px, 5vw, 44px); color: var(--nau); line-height: 1.1; }
.section-head .btn-nau { margin-left: auto; }

.guild { background: var(--nau-dam); color: var(--kem); border-radius: 28px; padding: 36px; display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.guild-text { flex: 1 1 320px; min-width: 0; }
.guild-text .over { font-weight: 600; font-size: 14px; letter-spacing: .08em; color: var(--vang); }
.guild-text h2 { margin: 6px 0 10px; font-family: var(--font-tieu-de); font-weight: 800; font-size: 40px; }
.guild-text p { margin: 0; color: #EADBC0; }
.guild-ids { flex: 1 1 320px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.guild-id { background: rgba(250,245,229,.08); border: 2px solid rgba(250,245,229,.25); border-radius: 18px; padding: 16px; text-align: left; color: var(--kem); cursor: pointer; }
.guild-id small { display: block; font-size: 13px; color: #EADBC0; }
.guild-id b { font-family: var(--font-tieu-de); font-weight: 800; font-size: 28px; }
.guild-id em { display: block; font-style: normal; font-size: 12px; color: var(--vang); min-height: 18px; }

.rules { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.rules li { display: flex; gap: 14px; align-items: flex-start; background: #fff; border-radius: 18px; padding: 16px 18px; border: 2px solid var(--vien); font-size: 15px; }
.rules li span:first-child { font-family: var(--font-tieu-de); font-weight: 800; font-size: 22px; color: var(--go); line-height: 1.2; }

.footer { background: var(--nau-dam); color: #EADBC0; margin-top: 24px; }
.footer .wrap { padding-top: 28px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.footer a { color: var(--vang); }
.footer .right { margin-left: auto; font-size: 14px; }

/* ===== Khung ảnh ===== */
.frame {
  position: relative; display: block; width: 100%;
  margin: 0; padding: 14px 14px 56px; border: 0;
  background: #fff; color: var(--chu); text-align: center; cursor: pointer;
  box-shadow: 0 12px 26px rgba(74,44,26,.22);
  transform: rotate(var(--rot, 0deg));
  transition: transform .25s ease, box-shadow .25s ease;
}
.frame:hover, .frame:focus-visible { transform: rotate(0deg) scale(1.04); box-shadow: 0 22px 44px rgba(74,44,26,.3); z-index: 2; }
.frame .tape { position: absolute; top: -12px; left: 50%; width: 92px; height: 26px; margin-left: -46px; background: rgba(232,120,154,.5); transform: rotate(-3deg); }
.frame .photo { display: block; position: relative; width: 100%; aspect-ratio: 1 / 1; background: #F6EEDC; overflow: hidden; }
.frame .photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(.28) saturate(.92); opacity: 0; transition: opacity .4s, filter .3s; }
.frame .photo img.loaded { opacity: 1; }
.frame:hover .photo img { filter: none; }
.frame .cap, .frame .stamp, .frame .tape { display: block; }
.frame .stamp { position: absolute; right: 24px; bottom: 64px; font: 700 14px 'Courier New', monospace; color: var(--cam-film); text-shadow: 0 0 2px rgba(0,0,0,.45); }
.frame .cap { position: absolute; left: 10px; right: 10px; bottom: 12px; font-family: var(--font-tay); font-size: 21px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame.wood { padding: 16px 16px 58px; border: 16px solid #8B5A3C; border-image: linear-gradient(135deg, #A06A43, #6B3E26 40%, #9A6640 70%, #5A321D) 1; box-shadow: inset 0 0 0 2px #E9D9B8, 0 14px 28px rgba(74,44,26,.3); }
.frame.gold { background: #FFFDF6; padding: 16px 16px 58px; border: 12px double #C9A14A; box-shadow: 0 0 0 4px #8C6A22, 0 14px 28px rgba(74,44,26,.3); }
.frame.wood .stamp, .frame.gold .stamp { bottom: 66px; right: 26px; }
.frame.deleted .photo img { filter: grayscale(1) opacity(.6); }
.frame .del-stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%) rotate(-12deg); border: 3px solid var(--hong-dam); color: var(--hong-dam); font: 800 22px var(--font-tieu-de); padding: 2px 12px; border-radius: 8px; background: rgba(255,255,255,.75); }
.sleeping { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--go); font-size: 14px; padding: 12px; text-align: center; }
.frame .photo .sleeping img { width: 56px; height: 56px; object-fit: contain; opacity: .85; filter: grayscale(.3); }
.skeleton { position: absolute; inset: 0; background: linear-gradient(100deg, #F6EEDC 30%, #FBF6EA 50%, #F6EEDC 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.polaroid-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px; padding: 8px; }

/* ===== Góc kỷ niệm ===== */
.g-hero { text-align: center; padding-top: 56px; padding-bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.g-hero .kicker { font-family: var(--font-tay); font-size: 24px; color: var(--hong-dam); }
.g-hero h1 { margin: 0; font-family: var(--font-tieu-de); font-weight: 800; font-size: clamp(44px, 7vw, 64px); line-height: 1; color: var(--nau); }
.g-hero p { margin: 0; font-size: 17px; color: var(--chu-phu); max-width: 560px; }

.clothesline { position: relative; padding-top: 32px; padding-bottom: 48px; }
.clothesline svg.line { position: absolute; left: 24px; top: 14px; width: calc(100% - 48px); height: 60px; }
.clothesline .pins { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px; position: relative; }
.clothesline .frame { padding: 10px 10px 40px; }
.clothesline .frame .cap { font-size: 18px; bottom: 8px; }
.clothesline .frame .cap, .frame .stamp, .frame .tape { display: block; }
.frame .stamp { bottom: 46px; right: 18px; font-size: 12px; }
.clothesline .peg { position: absolute; top: -18px; left: 50%; margin-left: -7px; width: 14px; height: 34px; border-radius: 3px; background: #C68B59; border: 2px solid var(--nau); z-index: 1; }
.clothesline .pins > :nth-child(2) { margin-top: 18px; }
.clothesline .pins > :nth-child(3) { margin-top: 26px; }
.clothesline .pins > :nth-child(4) { margin-top: 8px; }

.filters { display: flex; flex-direction: column; gap: 16px; align-items: center; padding-bottom: 28px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tab { min-height: 44px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; cursor: pointer; border: 2px solid var(--nau); background: #fff; color: var(--nau); display: inline-flex; align-items: center; gap: 6px; }
.tab[aria-selected="true"] { background: var(--nau); color: var(--kem); }
.search { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.search label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #6B4A33; }
.search input { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 2px solid #D9BF8E; background: #fff; font: 15px var(--font-chu); color: var(--chu); width: 240px; max-width: 100%; }
.search button { align-self: flex-end; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 2px solid #D9BF8E; background: transparent; color: var(--nau); cursor: pointer; font-weight: 600; }

.wall {
  background-color: #E9D9B8;
  background-image: radial-gradient(rgba(107,62,38,.10) 1px, transparent 1.4px);
  background-size: 14px 14px;
  border-top: 2px dashed #D9BF8E; border-bottom: 2px dashed #D9BF8E;
}
.wall .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 44px 34px; align-items: start; padding-top: 56px; padding-bottom: 40px; }
.wall .empty { grid-column: 1 / -1; text-align: center; padding: 40px 0; font-family: var(--font-tay); font-size: 24px; color: var(--go); }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-bottom: 48px; }
.page-btn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 2px solid var(--nau); background: #fff; color: var(--nau); font-weight: 700; cursor: pointer; }
.page-btn[aria-current="page"] { background: var(--nau); color: var(--kem); }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-dots { align-self: center; color: var(--go); }

/* ===== Hộp xem ảnh lớn ===== */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(43,26,16,.82); display: none; align-items: center; justify-content: center; padding: 24px 64px; }
.lightbox.open { display: flex; }
.lb-frame { margin: 0; background: #fff; padding: 18px 18px 18px; max-width: min(720px, 100%); width: 100%; position: relative; box-shadow: 0 30px 60px rgba(0,0,0,.45); transform: rotate(-1deg); }
.lb-frame .lb-img { position: relative; background: #F6EEDC; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.lb-frame img { width: 100%; max-height: 66vh; object-fit: contain; display: block; }
.lb-info { padding-top: 12px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.lb-comment { font-family: var(--font-tay); font-size: 26px; line-height: 1.25; color: var(--chu); margin: 0; }
.lb-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: #6B4A33; }
.lb-meta .date { margin-left: auto; font: 700 15px 'Courier New', monospace; color: #C25A12; }
.lb-close, .lb-nav { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--nau-dam); background: var(--vang); color: var(--nau-dam); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.lb-close { top: -20px; right: -20px; }
.lb-nav { top: 50%; margin-top: -24px; position: fixed; background: #fff; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-nav:disabled { opacity: .3; cursor: default; }

/* Hộp nhập mật khẩu */
.dialog { border: 0; border-radius: 24px; padding: 28px; max-width: 380px; width: calc(100% - 32px); background: var(--kem); color: var(--chu); box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.dialog::backdrop { background: rgba(43,26,16,.6); }
.dialog h2 { margin: 0 0 8px; font-family: var(--font-tieu-de); font-size: 26px; color: var(--nau); }
.dialog input { width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 2px solid #D9BF8E; font: 15px var(--font-chu); margin: 8px 0; }
.dialog .err { color: var(--hong-dam); font-size: 14px; min-height: 20px; margin: 0; }
.dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.dialog .row button { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 2px solid var(--nau); font-weight: 600; cursor: pointer; background: #fff; color: var(--nau); }
.dialog .row button[type="submit"] { background: var(--nau); color: var(--kem); }

@media (max-width: 640px) {
  .nav-links { margin-left: 0; width: 100%; }
  .nav-links a { padding: 8px 12px; font-size: 14px; }
  .hero { padding-top: 36px; gap: 32px; }
  .guild { padding: 24px; }
  .footer .right { margin-left: 0; }
  .lightbox { padding: 24px 12px 88px; }
  .lb-nav { top: auto; bottom: 20px; margin-top: 0; }
  .lb-prev { left: calc(50% - 60px); }
  .lb-next { right: calc(50% - 60px); }
  .lb-close { right: -8px; top: -24px; }
  .wall .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 18px; }
  .frame { padding: 8px 8px 40px; }
  .frame .cap { font-size: 17px; bottom: 8px; }
  .frame .cap, .frame .stamp, .frame .tape { display: block; }
.frame .stamp { bottom: 46px; right: 14px; font-size: 11px; }
  .frame.wood, .frame.gold { padding: 8px 8px 40px; border-width: 10px; }
  .frame.wood .stamp, .frame.gold .stamp { bottom: 46px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
