@charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

/* ==========================================
   0. RESET
   ========================================== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* ==========================================
   1. พื้นหลังหลักของเว็บไซต์ (Body)
   ========================================== */
body {
    font-family: 'Kanit', Tahoma, Geneva, sans-serif;
    color: #333333;
    line-height: 1.6;
    margin: 0;
    padding: 0; /* ชิดขอบทุกด้านตามที่ต้องการ */
    background-color: #0f172a; /* สีสำรองกรณีรูปพื้นหลังใน index.php โหลดไม่ขึ้น */
}


a:link, a:visited {
    text-decoration: none;
    color: #2563eb;
}

img {
    max-width: 100%;
    height: auto;
}

/* เดิม index.php ใช้ <font color="white">...</font> สำหรับข้อความบนพื้นหลังเข้ม
   เนื่องจากธีมใหม่เป็นการ์ดพื้นสว่าง ต้อง override attribute color ที่ฝังมากับ HTML
   (attribute เก่าจะแพ้ CSS selector ธรรมดาเสมอ ไม่ต้องใช้ !important) */
font {
    color: inherit;
}

b, strong {
    font-weight: 600;
}

/* ==========================================
   2. เลย์เอาต์หลัก (Wrapper / Section / Pic-top)
   ========================================== */
.wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: visible;
}

.section1 {
    width: auto;
    background-color: rgba(255, 245, 248, 0.92);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.pic-top {
    width: auto;
    margin: 0 auto;
    overflow: hidden;
    display: block;
}

.pic-top img {
    width: 100%;
    height: auto;
    display: block;
}

/* .content ถูกใช้ 2 จุดใน index.php: ตัวห่อหลักหลังแบนเนอร์ และตัวห่อเนื้อหาข้างใน box-content */
.content {
    width: auto;
    height: auto;
    overflow: visible;
    display: block;
    text-align: left;
    padding: 30px 25px;
    color: #334155;
    font-size: 1rem;
}

.box-content {
    width: auto;
    height: auto;
    overflow: visible;
    display: block;
    text-align: left;
    padding: 10px 0;
    color: #334155;
    font-size: 1rem;
}

/* ส่วนที่ยังต้องการให้อยู่กึ่งกลางแม้ .content จะชิดซ้ายแล้ว */
#show_rank,
.index_top3,
.tabs {
    text-align: center;
}

.sub-content {
    width: 94%;
    margin: auto;
    overflow: hidden;
    display: block;
    text-align: center;
    padding: 20px;
}

/* ==========================================
   3. บล็อกหัวข้อ .block (ตรงกับไฟล์ใหม่เป๊ะๆ) — ครอบด้วย index.php แล้ว
   ========================================== */
.block {
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    padding: 18px 20px;
    margin: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: left;
}

.event-time {
    font-size: 1.1rem;
    font-weight: 500;
    color: #d97706;
}

/* ==========================================
   4. หัวข้อ h.a1 / h.a2 (แท็ก <h class="a1/a2"> ของเดิม)
   h.a2 ตัวแรกในหน้าใช้เป็นชื่อหัวข้อหลัก ~ .main-title ของไฟล์ใหม่
   h.a1 ที่อยู่ในกรอบ .block ~ .block h2 ของไฟล์ใหม่
   ========================================== */
h.a2 {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    letter-spacing: 1px;
    margin: 0 0 25px;
}

.block h.a1 {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e40af;
    text-align: left;
    margin-bottom: 10px;
}

/* h.a1 ที่อยู่นอก .block (กรณีอื่นๆ) ใช้สไตล์สำรอง */
h.a1 {
    display: block;
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e40af;
    margin: 10px 0;
}

@media screen and (max-width: 900px) {
    h.a2 { font-size: 1.6rem; }
    .block h.a1 { font-size: 1.1rem; }
}

/* ==========================================
   4. ปุ่มกด .bt-rank (เข้าร่วมกิจกรรม / รับคูปอง)
   ========================================== */
.bt-rank {
    width: auto;
    max-width: 320px;
    height: auto;
    overflow: hidden;
    display: table;
    clear: both;
    color: #ffffff;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50px;
    margin: 8px auto;
    padding: 12px 36px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.25s ease;
    text-align: center;
}

.bt-rank:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}

/* ==========================================
   5. แท็บ (Tabs) — .tabs / .tabs-style-bar
   ========================================== */
.tabs {
    position: relative;
    overflow: hidden;
    margin: 10px auto;
    width: 100%;
    font-weight: 400;
    font-size: 1.1em;
}

.tabs nav {
    text-align: center;
}

.tabs nav ul {
    position: relative;
    display: flex;
    margin: 0 auto;
    padding: 0;
    max-width: 360px;
    list-style: none;
    flex-flow: row wrap;
    justify-content: center;
    gap: 8px;
}

.tabs nav ul li {
    position: relative;
    z-index: 1;
    display: block;
    margin: 0;
    text-align: center;
    flex: 1;
}

.tabs nav a {
    position: relative;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 2.6;
    border-radius: 50px;
}

.tabs nav a span {
    vertical-align: middle;
    font-size: 0.85em;
}

.tabs nav a:focus {
    outline: none;
}

.content-wrap {
    position: relative;
}

.content-wrap section {
    display: none;
    margin: 0 auto;
    padding-top: 1em;
    max-width: 100%;
    text-align: center;
}

.content-wrap section.content-current {
    display: block;
}

.content-wrap section p {
    margin: 0;
    color: inherit;
}

.no-js .content-wrap section {
    display: block;
    padding-bottom: 2em;
    border-bottom: 1px solid #e2e8f0;
}

.no-flexbox nav ul {
    display: block;
}

.no-flexbox nav ul li {
    min-width: 15%;
    display: inline-block;
}

/* สไตล์ bar: ปุ่มแท็บทรงแคปซูล ธีมฟ้า-ขาว แทนภาพ sprite เดิม */
.tabs-style-bar nav ul {
    border: 1px solid transparent;
}

.tabs-style-bar nav ul li a {
    margin: 0 2px;
    background: #eef2ff;
    color: #1e40af;
    transition: background-color 0.2s, color 0.2s;
}

.tabs-style-bar nav ul li a:hover,
.tabs-style-bar nav ul li a:focus {
    background: #dbeafe;
    color: #1d4ed8;
}

.tabs-style-bar nav ul li a span {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1em;
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
}

.tabs-style-bar nav ul li.tab-current a {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

@media screen and (max-width: 58em) {
    .tabs nav a.icon span { display: none; }
    .tabs nav a:before { margin-right: 0; }
}

/* ==========================================
   6. รางวัล / อันดับ TOP3 (.medal-reward, .index_top3, .box-rank, .table2, .frame1-3, .pic-rank)
   ========================================== */
.medal-reward {
    font-size: 1.08rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.index_top3 {
    width: 100%;
}

.box-rank {
    width: auto;
}

.table2 {
    width: 100%;
    max-width: 370px;
    border-collapse: collapse;
    font-size: 14px;
    margin: 10px auto;
    color: #334155;
    text-align: center;
}

.table2 td {
    padding: 6px;
}

.frame1, .frame2, .frame3 {
    width: 140px;
    height: 140px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    border-radius: 50%;
    background: #f8fafc;
}

.frame1 { box-shadow: 0 0 0 4px #fbbf24, 0 6px 16px rgba(0,0,0,.15); }
.frame2 { box-shadow: 0 0 0 4px #cbd5e1, 0 6px 16px rgba(0,0,0,.15); }
.frame3 { box-shadow: 0 0 0 4px #d97706, 0 6px 16px rgba(0,0,0,.15); }

.pic-rank {
    width: 105px;
    height: 105px;
    overflow: hidden;
    display: block;
    border-radius: 100px;
    border: solid #fff 3px;
    margin: auto;
}

.pic-rank2 {
    width: 50px;
    height: 50px;
    border-radius: 100px;
    border: solid #fff 3px;
    margin: auto;
}

.pic-rank3 {
    width: 40px;
    height: 40px;
    border-radius: 100px;
    border: solid #fff 3px;
    margin: auto;
}

/* ==========================================
   7. ตารางอันดับหลัก (.box-table, .table-1, .table1, .table3, .border-bottom)
   ========================================== */
.box-table {
    width: 100%;
    overflow: hidden;
    display: block;
    margin: auto;
}

.table-1 {
    width: 92%;
    max-width: 700px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    margin: 10px auto;
    color: #334155;
    text-align: center;
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
    border: solid 2px #dbeafe;
}

.table-1 th {
    color: #dbe4f3;
}

.border-bottom th {
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 4px;
    font-weight: 400;
}

.table1 {
    width: 80%;
    border-collapse: collapse;
    font-size: 16px;
    margin: 10px auto 20px;
    background: #ffffff;
    border: #dbeafe solid 1px;
    color: #334155;
    text-align: center;
}

.table1 th {
    text-align: center;
    padding: 8px;
    border: 1px solid #dbeafe;
    background-color: #3b82f6;
    color: #ffffff;
}

.table1 td {
    text-align: center;
    padding: 8px;
    border: 1px solid #e2e8f0;
}

/* ==========================================
   7.5 หน้าตรวจสอบ/รับรางวัล (rwd-table, td-info, bt-receive ฯลฯ)
   ========================================== */
.rwd-table {
    width: 100%;
    max-width: 420px;
    margin: 10px auto;
    border-collapse: collapse;
    color: #334155;
    background: #f8fafc;
    border-radius: 14px;
    overflow: hidden;
}

.rwd-table td,
.rwd-table th {
    border: 1px solid #e2e8f0;
    padding: 8px;
}

.td-info {
    background: #eef2ff;
}

.td-info .uimg {
    width: 90px;
    height: 90px;
    border-radius: 100px;
    border: solid #fff 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    margin: 8px auto;
    display: block;
}

.td-info-sum {
    color: #64748b;
    font-size: 0.85em;
}

.table-reward {
    background: #ffffff;
}

.table-reward th {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 600;
}

.tr-treward {
    background: #f1f5f9;
    font-weight: 500;
    color: #1e40af;
}

.bt-receive {
    display: table;
    margin: 10px auto;
    padding: 10px 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.25s ease;
}

.bt-receive:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}

.received {
    color: #059669;
    font-weight: 600;
}

.received-time {
    color: #64748b;
    font-size: 0.85em;
    margin-top: 4px;
}

img#coin, img#coin-user, img#coin_week {
    max-width: 50px;
}

.table3 {
    width: 90%;
    border-collapse: inherit;
    font-size: 14px;
    margin-bottom: 10px;
    color: #334155;
    text-align: center;
    border-radius: 1em;
    overflow: hidden;
    background: #ffffff;
    border: solid 2px #dbeafe;
}

.table3 td, .table3 th {
    padding-top: 10px;
    padding-bottom: 10px;
    font-weight: 400;
}

.table3 td {
    background: linear-gradient(0deg, #eef2ff 0%, #f8fafc 100%);
}

.icon-maserati {
    width: 60px;
    height: 60px;
    overflow: hidden;
    margin: auto;
}

.img-1 {
    height: 40px;
}

.highlight {
    background-color: #fef08a;
    color: #1e293b;
    padding: 15px 30px;
    font-weight: 600;
    border-radius: 8px;
}

/* ==========================================
   8. หมายเหตุ (.note) และ footer (.foot)
   ========================================== */
.note {
    width: auto;
    overflow: hidden;
    display: block;
    text-align: left;
    background-color: #fffbeb;
    border: 1px solid #fef08a;
    border-radius: 12px;
    padding: 20px;
    margin: 30px 0 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.note > font:first-child {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

#note {
    font-size: calc(var(--base-font-size, 16px) * 0.9);
}

#note p span {
    font-size: calc(var(--base-font-size, 16px) * 0.9);
}

.note font {
    color: #b45309;
}

.note a {
    color: #2563eb;
    font-weight: 600;
}

.note a:hover {
    text-decoration: underline;
}

.foot {
    width: auto;
    overflow: hidden;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    background: #0f172a;
    padding: 18px 20px;
}

/* ==========================================
   9. Responsive สำหรับมือถือ
   ========================================== */
@media screen and (max-width: 900px) {
    .content { font-size: 0.95rem; }
    .note { font-size: 0.9rem; }
    .box-content { font-size: 0.9rem; }
    .sub-content { width: 98%; padding: 10px; }
    .table3 { width: 100%; font-size: 12px; }
}

@media screen and (min-width: 660px) {
    .box-table1 { width: 100%; }
}

@media screen and (max-width: 600px) {
    body { padding: 0; }
    .section1 { border-radius: 0; }
    .content, .box-content { padding: 20px 15px; }
    .bt-rank { width: 90%; }
}

@media screen and (min-width: 370px) and (max-width: 400px) {
    .bt-rank { width: 80%; }
    table { width: 100%; }
    .box-table { width: 100%; }
    .box-content { padding: 5px; font-size: 16px; }
    .table1 { width: 100%; font-size: 13px; }
    .table2 { width: 98%; font-size: 14px; margin-bottom: 10px; }
    .table3 { font-size: 12px; }
    .frame1, .frame2, .frame3 { width: 110px; height: 110px; }
    .pic-rank { width: 82px; height: 82px; margin-top: 12px; }
    .pic-rank2 { width: 40px; height: 40px; }
    .icon-maserati { width: 40px; height: 40px; }
}

@media screen and (min-width: 410px) and (max-width: 500px) {
    .table1 { width: 100%; font-size: 13px; }
    .table2 { width: 98%; font-size: 14px; margin-bottom: 10px; }
    .table3 { font-size: 12px; }
    .pic-rank2 { width: 40px; height: 40px; }
    .icon-maserati { width: 40px; height: 40px; }
}

@media screen and (min-width: 320px) and (max-width: 360px) {
    .bt-rank { width: 80%; }
    table { width: 100%; font-size: 13px; }
    .box-table { width: 100%; }
    .sub-content { width: 98%; padding: 0; }
    .box-content { padding: 0; font-size: 12px; }
    .table1 { width: 100%; font-size: 12px; }
    .table2 { width: 98%; font-size: 14px; margin-bottom: 10px; }
    .table3 { width: 100%; font-size: 12px; }
    .frame1, .frame2, .frame3 { width: 110px; height: 110px; }
    .pic-rank { width: 82px; height: 82px; margin-top: 12px; }
    .pic-rank2 { width: 40px; height: 40px; }
    .icon-maserati { width: 40px; height: 40px; }
}
