@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* พื้นหลัง: ภาพบ้านนอก/ต่างจังหวัด + overlay โทนฟ้าอ่อนให้ตัวอักษรอ่านง่าย (ต้องการใช้รูปเอง: ใส่ bg-countryside.jpg ใน assets/images/ แล้วเปลี่ยน url ด้านล่างเป็น url('../images/bg-countryside.jpg')) */
    background-image:
        linear-gradient(180deg,
            rgba(240, 244, 255, 0.28) 0%,
            rgba(228, 234, 251, 0.32) 35%,
            rgba(216, 224, 248, 0.36) 65%,
            rgba(204, 214, 245, 0.4) 100%
        ),
        url('https://images.unsplash.com/photo-1500382017468-9049fed747ef?w=1920');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: #2d3561;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ส่วนบน: โทนม่วงฟ้าเข้มชัดเจน ต่างจากด้านล่าง */
header {
    padding: 18px 0;
    backdrop-filter: blur(20px);
    background: linear-gradient(135deg, #9ba8ed 0%, #7b8ce8 50%, #6b7cd8 100%);
    box-shadow: 0 8px 28px rgba(91, 108, 200, 0.35);
    border-bottom: 2px solid rgba(255, 255, 255, 0.25);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* โลโก้ทรงกลม โทนม่วงฟ้า */
.brand-logo {
    width: 56px;
    height: 56px;
    min-width: 56px;
    max-width: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    aspect-ratio: 1;
    background: linear-gradient(145deg, #8b9ae8 0%, #6b7fd7 50%, #5a6bc9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(107, 127, 215, 0.45);
    overflow: hidden;
}

/* โลโก้บน header: ให้ตัดกับแถบม่วงเข้ม */
header .brand-logo {
    background: linear-gradient(145deg, #fff 0%, #e8ecfc 50%, #d4dcf8 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ข้อความ 3 บรรทัด ชิดซ้าย เรียงแนวเดียวกัน */
.brand-lines {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

/* หัวข้อหลัก — เน้นให้เข้ม เด่นกว่าข้อความอื่น */
.brand-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    letter-spacing: 0.03em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

.brand-subtitle {
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
    align-self: center;
    text-align: center;
    display: block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.brand-proverb {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    font-style: italic;
    line-height: 1.4;
    align-self: center;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    /* marquee container */
    max-width: 560px;
    width: min(560px, 70vw);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    /* fade edges */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
            mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.brand-proverb-inner {
    display: inline-block;
    padding-left: 10px;
    will-change: transform;
    animation: brandProverbMarquee 22s linear infinite;
    /* โหมด B: ปกติ "อยู่นิ่ง" แล้วค่อยเลื่อนเมื่อ hover */
    animation-play-state: paused;
    /* ทำให้ตอนนิ่งอยู่ตำแหน่งกลาง (ไม่หลุดออกนอกกรอบ) */
    animation-delay: -11s;
}

header .brand-proverb:hover .brand-proverb-inner,
header .brand:hover .brand-proverb-inner {
    animation-play-state: running;
}

@keyframes brandProverbMarquee {
    0%   { transform: translateX(110%); }
    100% { transform: translateX(-110%); }
}

@media (prefers-reduced-motion: reduce) {
    .brand-proverb-inner {
        animation: none;
        animation-play-state: initial;
        animation-delay: 0s;
    }
}

/* หน้าอื่นที่ยังใช้ .brand-text */
.brand-text h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: #2d3561;
}

.brand-text span {
    font-size: 0.8rem;
    color: #5c6496;
}

/* หัวข้อหลักบน header (หน้าอื่นที่ใช้ .brand-text) — คมชัด สีชัดเจนเทียบเท่า .brand-title */
header .brand-text h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.03em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

header .brand-text span {
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.main-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-left: auto;
    justify-content: flex-end;
}

/* ปุ่มเมนูสไลด์ — กดแล้วโชว์สองปุ่ม (ดูรายชื่อ + Admin) */
.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}
.nav-toggle .icon {
    font-size: 1.2rem;
    line-height: 1;
}
.nav-slide-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    order: 10;
}
.main-nav.is-open .nav-slide-wrap {
    max-height: 120px;
    opacity: 1;
}

.nav-pill {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: #1e2444;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ปุ่มหลัก CTA — สีส้ม–เหลืองเชิญชวน ดึงดูดให้ลงทะเบียน */
.btn-primary {
    border-radius: 999px;
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, #ea580c 0%, #f59e0b 50%, #eab308 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(234, 88, 12, 0.45), 0 2px 8px rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(234, 88, 12, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #f97316 0%, #fbbf24 50%, #facc15 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ปุ่มบน header: ใช้สี CTA เดียวกัน ให้เห็นชัดบนพื้นม่วง */
header .btn-primary {
    background: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(234, 88, 12, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.6);
}

header .btn-primary:hover {
    background: linear-gradient(135deg, #f97316 0%, #fbbf24 100%);
    color: #fff;
    box-shadow: 0 6px 24px rgba(234, 88, 12, 0.55), 0 0 0 2px rgba(255, 255, 255, 0.5);
}

header .btn-secondary {
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 9px 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

header .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

header .nav-toggle {
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

header .nav-toggle:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #fff;
}

header .nav-pill {
    color: #1e2444;
    font-weight: 600;
}

.btn-primary span.icon {
    font-size: 1.1rem;
}

.btn-secondary {
    border-radius: 999px;
    padding: 9px 18px;
    border: 2px solid #6b7cd8;
    background: #fff;
    color: #2d3561;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 12px rgba(107, 124, 216, 0.2);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    background: #f0f2ff;
    box-shadow: 0 4px 16px rgba(107, 124, 216, 0.25);
}

.btn-secondary span.icon {
    font-size: 1rem;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 28px 24px 40px;
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    gap: 0;
}

.hero {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
    gap: 40px;
    align-items: center;
    margin-bottom: 32px;
}

.hero-text {
    padding-right: 16px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid rgba(107, 124, 216, 0.4);
    box-shadow: 0 2px 12px rgba(107, 127, 215, 0.15);
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3561;
    margin-bottom: 12px;
}

.eyebrow span.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #7b8ce8, #9b7ed8);
    color: #fff;
    font-size: 0.85rem;
}

.hero-title {
    font-size: clamp(1.9rem, 3vw, 2.4rem);
    line-height: 1.35;
    font-weight: 700;
    color: #1e2444;
    margin-top: 4px;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.hero-who {
    font-size: 0.95rem;
    font-weight: 500;
    color: #4c3317;
    line-height: 1.55;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(255, 250, 240, 0.95);
    border-radius: 14px;
    border-left: 4px solid #7b8ce8;
    box-shadow: 0 2px 12px rgba(107, 127, 215, 0.08);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(107, 124, 216, 0.35);
    font-size: 0.85rem;
    font-weight: 500;
    color: #2d3561;
}

.meta-pill span.icon {
    font-size: 1rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.link-ghost {
    border-radius: 999px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: #4c5fb8;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
}

.link-ghost:hover {
    color: #2d3561;
    text-decoration: underline;
}

.link-ghost span.icon {
    font-size: 1rem;
}

.hero-footnote {
    font-size: 0.82rem;
    font-weight: 500;
    color: #3d4578;
    line-height: 1.55;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(107, 124, 216, 0.2);
}

.hero-footnote strong {
    color: #1e2444;
    font-weight: 700;
}

.hero-media {
    position: relative;
}

.media-card {
    position: relative;
    border-radius: 32px;
    padding: 22px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(228, 232, 252, 0.95));
    box-shadow:
        0 20px 45px rgba(107, 127, 215, 0.22),
        0 0 0 1px rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

.media-main {
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    background: #e8ecfc;
    min-height: 380px;
}

/* สไลด์โชว์รูปบนหน้าแรก — ความสูงพอให้รูปโชว์เต็ม (contain) */
.hero-carousel-wrap {
    position: relative;
    min-height: 380px;
}
.hero-carousel-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 0;
}
.hero-carousel-slide-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}
.hero-carousel-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}
.hero-carousel-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.meta-pill-link:hover {
    opacity: 0.9;
    box-shadow: 0 2px 12px rgba(107, 127, 215, 0.25);
}

.media-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.media-layer {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.35), transparent 50%),
                radial-gradient(circle at 90% 90%, rgba(200, 208, 245, 0.25), transparent 55%);
}

.media-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    gap: 8px;
}

.event-label {
    font-size: 0.85rem;
    color: #4a5285;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.chip {
    font-size: 0.75rem;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(220, 226, 248, 0.9);
    color: #4c5fb8;
}

/* ไม่โชว์ข้อความสถานะระบบ/ฐานข้อมูลให้ user */
.floating-card,
.system-status {
    display: none !important;
}

.floating-card {
    position: absolute;
    right: -6px;
    top: 12px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 10px 14px;
    box-shadow: 0 16px 35px rgba(107, 127, 215, 0.25);
    min-width: 170px;
}

.floating-card h4 {
    font-size: 0.9rem;
    color: #2d3561;
    margin-bottom: 4px;
}

.floating-card p {
    font-size: 0.78rem;
    color: #5c6496;
}

.floating-card .meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #6b75a8;
}

.floating-card .meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.floating-card .meta span.icon {
    font-size: 0.9rem;
}

.system-status {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.status-card {
    border-radius: 18px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(200, 208, 245, 0.7);
    font-size: 0.72rem;
    color: #4a5285;
}

.status-card strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.status-card.good {
    background: #e3f6e9;
    border-color: #b1e0c1;
    color: #256b3b;
}

.status-card.info {
    background: #e8ecfc;
    border-color: #c9d2f5;
    color: #4c5fb8;
}

/* ข้อความ footer: พื้นหลังสีขาว + เงา ให้อ่านชัด */
.page-wrapper > footer {
    padding: 14px 24px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e2450 !important;
    background: #ffffff;
    box-shadow: 0 -4px 20px rgba(45, 53, 97, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ========== แท็บเล็ต / iPad (900px ลงมา) ========== */
@media (max-width: 900px) {
    main {
        padding: 20px 18px 32px;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        margin-bottom: 28px;
    }

    header {
        padding: 18px 0;
    }

    .header-inner {
        padding-left: 18px;
        padding-right: 18px;
    }

    .hero-text {
        padding-right: 0;
    }

    .hero-title {
        font-size: clamp(1.5rem, 4.5vw, 1.9rem);
    }

    .media-card {
        padding: 18px;
        border-radius: 24px;
    }

    .media-main {
        min-height: 320px;
    }

    .floating-card {
        min-width: 150px;
        padding: 8px 12px;
    }

    .system-status {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ========== มือถือใหญ่ / iPad แนวตั้ง (768px ลงมา) ========== */
@media (max-width: 768px) {
    header {
        padding: 14px 0;
    }

    .header-inner {
        padding-left: 16px;
        padding-right: 16px;
    }

    .brand-title {
        font-size: 1.35rem;
    }

    .brand-subtitle {
        font-size: 0.78rem;
    }

    .brand-proverb {
        font-size: 0.72rem;
    }

    .nav-pill {
        font-size: 0.82rem;
        padding: 8px 14px;
    }

    .hero-title {
        font-size: clamp(1.35rem, 5vw, 1.6rem);
        margin-bottom: 14px;
    }

    .hero-who {
        font-size: 0.88rem;
        padding: 10px 14px;
        margin-bottom: 16px;
    }

    .hero-meta {
        gap: 8px;
        margin-bottom: 16px;
    }

    .meta-pill {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    .hero-actions .btn-primary,
    .hero-actions .btn-secondary,
    .hero-actions .link-ghost {
        justify-content: center;
        min-height: 48px;
        padding: 12px 16px;
    }

    .hero-footnote {
        font-size: 0.8rem;
    }

    .media-card {
        padding: 14px;
        border-radius: 20px;
    }

    .media-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .chips {
        justify-content: flex-start;
    }

    .floating-card {
        position: static;
        margin-top: 12px;
        min-width: auto;
        width: 100%;
    }

    .system-status {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .status-card {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    .page-wrapper > footer {
        padding: 16px 16px 24px;
        font-size: 0.85rem;
    }
}

/* ========== มือถือ (600px ลงมา) ========== */
@media (max-width: 600px) {
    header {
        padding: 14px 0;
    }

    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-left: calc(14px + env(safe-area-inset-left));
        padding-right: calc(14px + env(safe-area-inset-right));
    }

    .brand {
        gap: 10px;
    }

    .brand-logo {
        width: 48px;
        height: 48px;
        min-width: 48px;
        max-width: 48px;
    }

    .brand-title {
        font-size: 1.2rem;
        line-height: 1.3;
    }

    .brand-subtitle {
        font-size: 0.75rem;
    }

    .brand-proverb {
        font-size: 0.7rem;
        margin-top: 2px;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        justify-content: flex-end;
    }

    .nav-pill {
        width: 100%;
        text-align: center;
        order: 3;
    }

    header .btn-secondary,
    header .btn-primary {
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    main {
        padding: 16px 14px 28px;
    }

    .hero {
        gap: 20px;
        margin-bottom: 24px;
    }

    .announcements-section {
        margin-bottom: 24px;
    }

    .latest-members-section {
        margin-bottom: 20px;
    }

    .eyebrow {
        font-size: 0.78rem;
        padding: 5px 12px;
    }

    .eyebrow span.badge {
        width: 20px;
        height: 20px;
        font-size: 0.78rem;
    }

    .hero-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    .hero-who {
        font-size: 0.82rem;
        padding: 10px 12px;
    }

    .meta-pill {
        font-size: 0.78rem;
    }

    .media-card {
        padding: 12px;
        border-radius: 18px;
    }

    .media-main {
        min-height: 280px;
        border-radius: 16px;
    }

    .event-label {
        font-size: 0.8rem;
    }

    .chip {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}

/* ========== มือถือเล็ก (480px ลงมา) ========== */
@media (max-width: 480px) {
    .brand-title {
        font-size: 1.1rem;
    }

    .brand-subtitle {
        font-size: 0.72rem;
    }

    .hero-title {
        font-size: 1.2rem;
    }

    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        font-size: 0.9rem;
    }

    .media-main {
        min-height: 240px;
    }
}

/* ========== หน้า Admin Login (และหน้าอื่นที่ใช้ .login-shell) ========== */
@media (max-width: 600px) {
    .login-shell {
        margin: 20px 14px 40px;
        padding: 18px 16px 22px;
        border-radius: 22px;
        max-width: none;
    }

    .login-shell h2 {
        font-size: 1.15rem;
    }

    .login-shell p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }

    .login-group input[type="text"],
    .login-group input[type="password"] {
        padding: 12px 14px;
        font-size: 16px; /* ลดการ zoom อัตโนมัติบน iOS */
    }

    .login-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-top: 16px;
    }

    .login-actions .btn-primary {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        padding: 12px 16px;
    }

    .login-actions span {
        text-align: center;
        order: 2;
    }

    .alert-error {
        padding: 10px 12px;
        font-size: 0.84rem;
    }
}

/* ========== การ์ดรายชื่อสมาชิก (หน้าแรก + หน้ารายชื่อเต็ม) แยกคนชัดเจน ========== */
.latest-members-section {
    width: 100%;
    margin-bottom: 24px;
}
.latest-members-section h3 {
    margin-bottom: 12px;
}
.latest-members-grid,
.member-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 640px) {
    .latest-members-grid,
    .member-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .latest-members-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .member-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ข่าวสาร/ประกาศ — กรอบข่าวชัด เน้นมือถือ ตัวกระพริบ/วิ่ง */
.announcements-section {
    width: 100%;
    margin-bottom: 28px;
    padding: 0;
}
.announcements-frame {
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.97);
    border: 2px solid #7b8ce8;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(107, 127, 215, 0.25);
    padding: 18px 16px 20px;
}
.announcements-inner {
    max-width: 100%;
}
.announcements-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3561;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.announcements-byline {
    font-size: 0.78rem;
    color: #6d7ab8;
    margin: 0 0 12px 0;
}
.announcements-icon {
    font-size: 1.25rem;
    display: inline-block;
    animation: announcements-icon-sway 1.2s ease-in-out infinite;
}
@keyframes announcements-icon-sway {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

/* แถบข่าวสารวันนี้ — วิ่ง + กระพริบ */
.announcements-ticker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(123, 140, 232, 0.2), rgba(123, 140, 232, 0.08));
    border-radius: 12px;
    border: 1px solid rgba(123, 140, 232, 0.35);
    overflow: hidden;
    animation: announcements-ticker-glow 2.5s ease-in-out infinite;
}
@keyframes announcements-ticker-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(123, 140, 232, 0.2); }
    50% { box-shadow: 0 0 0 4px rgba(123, 140, 232, 0.15); }
}
.announcements-ticker-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #4c3317;
    flex-shrink: 0;
    animation: announcements-blink 1.5s ease-in-out infinite;
}
@keyframes announcements-blink {
    0%, 100% { opacity: 1; text-shadow: 0 0 0 rgba(123, 140, 232, 0); }
    50% { opacity: 0.85; text-shadow: 0 0 8px rgba(123, 140, 232, 0.4); }
}
.announcements-ticker {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.announcements-ticker-track {
    display: inline-flex;
    white-space: nowrap;
    animation: announcements-scroll 28s linear infinite;
}
.announcements-ticker:hover .announcements-ticker-track {
    animation-play-state: paused;
}
.announcements-ticker-inner {
    flex-shrink: 0;
    padding-right: 3em;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2d3561;
}
@keyframes announcements-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.announcement-card {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #7b8ce8;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(107, 127, 215, 0.2);
    transition: box-shadow 0.2s ease;
}
.announcement-card:hover {
    box-shadow: 0 12px 28px rgba(107, 127, 215, 0.28);
}
.announcement-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: #4c3317;
    margin: 0 0 10px 0;
    line-height: 1.35;
}
.announcement-card__content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2d3561;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}
.announcement-card__date {
    font-size: 0.8rem;
    color: #8c6c4c;
}
.announcement-card--sample .announcement-card__content {
    color: #5a5a7a;
}
.announcement-card--sample .announcement-card__date {
    font-style: italic;
}
@media (min-width: 768px) {
    .announcements-frame { padding: 22px 20px 24px; }
    .announcement-card { padding: 18px 22px; }
    .announcement-card__title { font-size: 1.05rem; }
}

.member-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(200, 208, 245, 0.55);
    border-radius: 18px;
    padding: 14px 14px 12px;
    font-size: 0.9rem;
    box-shadow: 0 12px 28px rgba(107, 127, 215, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.member-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(107, 127, 215, 0.16);
}
.member-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.member-card__name {
    font-weight: 700;
    color: #5a3a1a;
    margin: 0;
    line-height: 1.2;
    font-size: 0.98rem;
}
.member-card__nickname {
    margin-top: 4px;
    font-size: 0.82rem;
    color: #9b7451;
}
.member-card__badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff5d7;
    color: #815220;
    border: 1px solid #f4d08f;
    white-space: nowrap;
    line-height: 1.2;
    flex-shrink: 0;
}
.member-card__meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.member-chip {
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f0f4ff;
    border: 1px solid #e4eafb;
    color: #2d3561;
}
.member-chip--warm {
    background: #fffdf8;
    border: 1px solid #f1e1cf;
    color: #8c6c4c;
}
.member-card__footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(170, 134, 102, 0.35);
    font-size: 0.76rem;
    color: #aa8666;
}
@media (max-width: 420px) {
    .member-chip { width: 100%; border-radius: 14px; }
}
