/*--story--*/
/* ===============================
   Root / Base
=============================== */
:root{
  --gap:12px;

  /* โทนพื้นฐาน */
  --bg:#0b0c0e;
  --card:#1a1a1a;
  --txt:#f5e9c8;
  --muted:#c7b98a;

  --stroke:#ffffff1a;

  /* โทนทองของทหารม้า */
  --cavalry-gold:#d4af37;
  --cavalry-gold-light:#ffe9a3;
  --cavalry-gold-dark:#b8860b;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--txt);
}

.header-image {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px; /* ↓ ลดลงนิดเดียว */
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

.rounded {
    border-radius: 3px;
}

.shadow {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.premium-frame {
   padding: 3px;
    background: linear-gradient(135deg, #d4af37, #b8860b); 
    border-radius: 10px;
    display: inline-block; 
    border : 2px solid #957e33;
    
   box-shadow:
        0 0 0 2px #000 inset,      
        0 4px 12px rgba(0,0,0,0.35); 
}

/* ===============================
   Header (ใช้ร่วมกันทุกหน้า)
=============================== */
/* ===============================
   Premium Cute Header (Cavalry 717)
=============================== */

/* ===============================
   Cute Header — Premium Final
=============================== */

.cute-header{
  max-width:1100px;
  margin:0 auto;
  padding:26px 16px 18px;
  text-align:center;
  border-bottom:1px solid rgba(212,175,55,.18);
}

/* Title Row */
.cute-header .title-row{
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
}

/* Sticker */
.cute-header .sticker{
  width:56px;
  height:56px;
  display:grid;
  place-items:center;
  border-radius:18px;
  background:linear-gradient(135deg, var(--cavalry-gold-light), var(--cavalry-gold));
  border:1px solid var(--cavalry-gold-dark);
  box-shadow:0 10px 28px rgba(0,0,0,.45);
  font-size:26px;
  color:#000;
}

/* Title */
.cute-header h1{
  margin:0;
  font-size:28px;
  font-weight:800;
  letter-spacing:0.6px;
  background:linear-gradient(90deg, var(--cavalry-gold-light), var(--cavalry-gold));
  -webkit-background-clip:text;
  color:transparent;
  text-shadow:0 0 10px rgba(212,175,55,.25);
}

/* Subtitle */
.cute-header p{
  margin:8px 0 0;
  color:var(--muted);
  font-size:14px;
  line-height:1.5;
}

/* Chips */
.cute-header .chips{
  margin-top:16px;
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}

.cute-header .chip{
  padding:7px 14px;
  border-radius:12px;
  background:rgba(212,175,55,.22);
  border:1px solid rgba(212,175,55,.45);
  color:var(--cavalry-gold-light);
  font-size:13px;
  font-weight:600;
  backdrop-filter:blur(5px);
  box-shadow:0 4px 12px rgba(0,0,0,.35);
}


/* Tablet */
@media (max-width:820px){
  .cute-header h1{ font-size:24px; }
  .cute-header p{ font-size:13px; }
  .cute-header .chip{ font-size:12px; padding:6px 12px; }
  .cute-header .sticker{ width:50px; height:50px; font-size:22px; }
}

/* Mobile */
@media (max-width:520px){
  .cute-header{ padding:22px 10px 14px; }
  .cute-header h1{ font-size:22px; }
  .cute-header p{ font-size:12.5px; }
  .cute-header .chip{ font-size:11.5px; padding:5px 10px; }
  .cute-header .sticker{ width:46px; height:46px; font-size:20px; }
}

/* Small Mobile */
@media (max-width:380px){
  .cute-header h1{ font-size:20px; }
  .cute-header p{ font-size:12px; }
  .cute-header .chip{ font-size:11px; padding:4px 8px; }
}


/* ===============================
   Gallery Grid
=============================== */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(190px,230px));
  gap:var(--gap);
  justify-content:center;
}

.item{
  background:#111;
  border-radius:12px;
  overflow:hidden;
  border:1px solid #333;
}

.item img{
  width:100%;
  height:230px;
  object-fit:cover;
  object-position:top;
  transition:transform .2s ease;
}

.item:hover img{
  transform:scale(1.05);
}

/*--กลับหน้าหลัก--*/
.footer-note{
  text-align:center;
  font-size:12px;
  color:var(--muted);
  margin:10px 0 30px;
}
/* ===============================
   Lightbox
=============================== */
.lb-hint {
    width: 100%;
    text-align: center;
    margin-top: 6px;
    font-size: 14px;
    color: var(--muted);
}

.lb-hint {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .35s ease, transform .35s ease;
}

.lb.playing .lb-hint {
    opacity: 0.25;          /* จางลง */
    transform: translateY(5px); /* ⭐ ขยับลงนิดเดียวเพื่อสื่อว่า “แตะตรงนี้” */
}

/*----*/
.lb{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.9);
  z-index: 999;

  /* ทำให้มีพื้นที่ดำรอบ ๆ และ “เหลือใต้ปุ่ม” ได้ */
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.lb.open{ display:flex; }

/* เปลี่ยนจาก full-screen เป็นพอดีเนื้อหา */

.lb-figure{
  width: auto;
  height: auto;

  max-width: 96vw;
  max-height: calc(100dvh - 140px);  /* เผื่อพื้นที่ปุ่ม+caption */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* รูป */
.lb img{
  max-width:96vw;
  max-height:calc(100dvh - 230px);
  object-fit:contain;
  border-radius:10px;
  background:#000;
  border:2px solid var(--cavalry-gold);
  box-shadow:0 0 20px rgba(212,175,55,.35);
}

/* Caption / Controls */
.btn{
  cursor:pointer;
  border:none;
}

a{
  color:var(--cavalry-gold-light);
}
.turn a {	
    display: block;
    width: 40%;
    max-width: 600px;
    padding: 10px 0;
    margin-top: 10px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: #000;
    background: linear-gradient(135deg, #d4af37, #b8860b);
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.45);
    transition: 0.25s;
}
.turn a:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.55);
}
body.cavalry-theme{
  --bg:#0b0c0e;
  --card:#1a1a1a;
  --txt:#f5e9c8;
  --muted:#c7b98a;
}

body.cavalry-theme .cute-header .sticker{
  background:linear-gradient(135deg, #d4af37, #b8860b);
  border-color:#d4af37;
}

body.cavalry-theme .cute-header h1{
  background:linear-gradient(90deg, #ffe9a3, #ffd36b);
  -webkit-background-clip:text;
  color:transparent;
}
.cute-header .chip{
  background:linear-gradient(135deg, var(--cavalry-gold), var(--cavalry-gold-dark));
  color:#000;
  border:1px solid var(--cavalry-gold);
}
box-shadow:
    0 0 20px rgba(212,175,55,.35),
    0 0 40px rgba(212,175,55,.15);
/* ===============================
   Layout / Hint
=============================== */
.wrap{
  max-width:1100px;
  margin:0 auto;
  padding:12px 16px 26px;
}

.hint{
  color:var(--muted);
  font-size:18px;/*--12--*/
  text-align:center;
}

.cute-hint {
  margin-top:14px;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid var(--stroke);
}
    
/*--gallery.php : back--*/
.back-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding-left: 40px;   /* ⭐ ขยับจากซ้ายแน่นอน */
    text-align: left;     /* ⭐ บังคับให้ปุ่มอยู่ซ้าย */
}

.gallery-back-btn {
    display: inline-block;
    margin: 15px 0 20px;
    padding: 10px 18px;
    background-color: #0A0F1F;
    color: #D4AF37;
    border-radius: 6px;
    font-size: 1.1rem;
    text-decoration: none;
}

.gallery-back-btn:hover {
    background-color: #11182D;
}

/* ปุ่ม auto — เวอร์ชันสุดท้าย */
.live-auto-center {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 18px;   /* ⭐ ลดระดับลงเล็กน้อย */
}

#autoBtn {
    font-size: 1.7rem;
    padding: 8px 16px;
    border-radius: 12px;
    background: #0A0F1F;
    color: #D4AF37;
    border: 2px solid #D4AF37;
}

/* ป้องกัน caption ดันปุ่มไปขวา */
.sp, .cute-cap {
    flex: 0 0 auto !important;
}

/* caption style */
.cute-cap {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    background: rgba(212,175,55,.35);
    color: #000;
}


#lbImg {
  transition: opacity .75s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* Mobile */
/* ===============================
   Responsive (Mobile & Tablet)
=============================== */

/* Tablet */
@media (max-width: 820px) {
  .lb img {
    max-height: calc(100dvh - 160px) !important;
  }
}

/* Mobile */
@media (max-width: 520px) {
  .lb img {
    max-height: calc(100dvh - 140px) !important;
  }
}


/* Mobile (≤ 520px) */
@media (max-width: 520px) {

  .wrap {
    padding: 8px 12px 20px;
  }

  .gallery-back-btn {
    font-size: 0.95rem;
    padding: 8px 12px;
  }

  #autoBtn {
    font-size: 1.4rem;
    padding: 6px 12px;
    border-radius: 10px;
  }

  .live-auto-center {
    margin-top: 14px;   /* ⭐ ลดระดับลงเล็กน้อยบนมือถือ */
  }

  .cute-cap {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Small Mobile (≤ 380px) */
@media (max-width: 380px) {

  #autoBtn {
    font-size: 1.3rem;
    padding: 6px 10px;
  }

  .cute-cap {
    font-size: 11px;
    padding: 5px 10px;
  }

  .gallery-back-btn {
    font-size: 0.9rem;
    padding: 7px 10px;
  }
}
@media (max-width: 520px) {
  .lb img {
    max-height: calc(100dvh - 160px) !important; /* ⭐ ลดส่วนหายไปด้านบน */
  }
}
@media (max-width: 520px) {
  .lb img {
    max-height: calc(100dvh - 150px) !important;
  }
}
@media (max-width: 520px){
  .lb{
    align-items: flex-start; /* เนื้อหาขยับขึ้นนิด */
    padding-top: 14px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom)); /* ⭐ พื้นที่ดำใต้ปุ่ม */
  }

  .lb-figure{
    margin-top: 10px;
    max-height: calc(100dvh - 190px); /* ⭐ กันไม่ให้ figure ยาวลงไปกินพื้นที่ดำด้านล่าง */
  }
}