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

:root {
  --bg-main: #020617;
  --bg-card: rgba(15, 23, 42, 0.95);
  --border-soft: rgba(148, 163, 184, .3);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --text-main: #e5f0ff;
  --text-dim: #94a3b8;
}

/* reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ================= GLOBAL BACKGROUND ================= */

body {
  margin: 0;
  font-family: 'Kanit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    linear-gradient(to bottom, rgba(2,6,23,.92), rgba(2,6,23,.98)),
    url('../images/bg.png') center/cover no-repeat fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =================== NAVBAR =================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: linear-gradient(to right, rgba(15,23,42,.9), rgba(15,23,42,.7));
  border-bottom: 1px solid rgba(148, 163, 184, .25);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.navbar.scrolled {
  background: linear-gradient(to right, rgba(15,23,42,.98), rgba(15,23,42,.9));
  box-shadow: 0 10px 30px rgba(15,23,42,.8);
}

.navbar-left {
  display: flex;
  align-items: center;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-logo {
  display: flex;
  gap: 10px;
  align-items: center;
}

.logo-circle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--accent-strong), #0f172a 60%);
}

.logo-text-main {
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 1.1rem;
}

.logo-text-sub {
  font-size: .8rem;
  color: var(--text-dim);
}

/* เมนูหลัก */

.nav-links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: 999px;
  transition: .18s ease;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(15,23,42,.9);
}

/* link active */
.nav-links a.nav-current {
  color: #0f172a;
  background: linear-gradient(to right, var(--accent), var(--accent-strong));
  font-weight: 500;
}

/* Hamburger button (default ซ่อน) */

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 28px;
  height: 3px;
  background: var(--text-main);
  border-radius: 6px;
}

/* =================== LAYOUT =================== */

.page-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 32px 16px 48px;
}

.page-container {
  width: 100%;
  max-width: 1080px;
}

/* =================== HERO (index.php) =================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.4fr);
  gap: 24px;
  align-items: center;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero-title .accent {
  color: var(--accent);
  text-shadow: 0 0 17px rgba(56, 189, 248, .75);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 480px;
}

.hero-buttons {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* hero panel */
.hero-panel {
  background: var(--bg-card);
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 45px rgba(15,23,42,.9);
  padding: 18px;
}

.hero-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.hero-stat-label {
  font-size: .8rem;
  color: var(--text-dim);
}

.hero-stat-value {
  font-size: 1.2rem;
  font-weight: 600;
}

.badge-online {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  background: rgba(22,163,74,.15);
  color: #bbf7d0;
  border: 1px solid rgba(34,197,94,.5);
}

.hero-panel-footer {
  margin-top: 14px;
  font-size: .8rem;
  color: var(--text-dim);
}

/* =================== AUTH CARD (login / register / dashboard) =================== */

.auth-wrap {
  max-width: 460px;
  margin: 0 auto;
}

.auth-card {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  padding: 22px 22px 26px;
  box-shadow: 0 18px 45px rgba(15,23,42,.9);
}

.auth-title {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-row-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: block;
  font-size: .84rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

/* =================== INPUT CONTROL (รวม date) =================== */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.6);
  background: rgba(15,23,42,.75);
  color: var(--text-main);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: .18s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56,189,248,.7);
}

/* date inner text & icon */
input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  color: var(--text-main);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(.9);
  opacity: .85;
}

/* helper text */
.helper-text {
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* =================== BUTTONS (auth-btn) =================== */

/* กัน hover / active / focus ไม่ให้มีขีดกลับมา */
.auth-btn:hover,
.auth-btn:active,
.auth-btn:focus,
.auth-btn-full:hover,
.auth-btn-sm:hover,
.auth-btn-lg:hover,
.auth-btn-outline:hover,
.auth-btn-outline:focus {
    text-decoration: none !important;
}

.auth-btn{
  --btn-a:#77c6ff;
  --btn-b:#3b82ff;
  --h:52px;
  position:relative;
  overflow:hidden;
  height:var(--h);
  padding:0 18px;
  border:0;
  border-radius:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  font-weight:800;
  font-size:.95rem;
  color:#fff;
  cursor:pointer;
  background:linear-gradient(180deg,var(--btn-a),var(--btn-b));
  box-shadow:0 10px 28px rgba(46,107,255,.38), 0 1px 0 rgba(255,255,255,.35) inset;
  transition:transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.auth-btn-full{ width:100%; }

.auth-btn-sm{
  --h:40px;
  padding:0 16px;
  border-radius:14px;
  font-size:.9rem;
}

.auth-btn:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 34px rgba(46,107,255,.46), 0 1px 0 rgba(255,255,255,.35) inset;
}

.auth-btn:active{
  transform:translateY(0);
  filter:brightness(.98);
}

.auth-btn::before{
  content:"";
  position:absolute;
  top:-30%;
  left:-40%;
  width:40%;
  height:160%;
  background:linear-gradient(75deg, rgba(255,255,255,0) 10%, rgba(255,255,255,.55) 45%, rgba(255,255,255,0) 90%);
  transform:skewX(-20deg);
  opacity:0;
  pointer-events:none;
}

.auth-btn:hover::before{
  animation:btnSheen .9s ease forwards;
}

@keyframes btnSheen{
  0%   { transform:translateX(0) skewX(-20deg); opacity:0; }
  40%  { opacity:1; }
  100% { transform:translateX(260%) skewX(-20deg); opacity:0; }
}

/* =================== SWEETALERT2 =================== */

.swal2-popup.blue-neon {
  border-radius: 16px !important;
  background: #020617 !important;
  border: 1px solid rgba(148,163,184,.5) !important;
  box-shadow: none !important;
}

.swal2-title.blue-neon-title {
  color: var(--text-main) !important;
  font-family: 'Kanit', sans-serif !important;
}

.swal2-html-container.blue-neon-html {
  color: var(--text-dim) !important;
  font-size: .9rem !important;
}

.swal2-styled.swal2-confirm.blue-btn {
  border-radius: 999px !important;
  background: linear-gradient(to right, var(--accent), var(--accent-strong)) !important;
  color: #0b1120 !important;
  font-weight: 500 !important;
  border: none !important;
  box-shadow: none !important;
}

.swal2-styled.swal2-cancel.blue-btn-outline {
  border-radius: 999px !important;
  background: transparent !important;
  border: 1px solid rgba(148,163,184,.5) !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
}

/* Toast */
.swal2-toast.blue-toast {
  background: rgba(15,23,42,.98) !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148,163,184,.5) !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
  padding: 8px 16px !important;
  font-size: .85rem !important;
}

/* =================== FOOTER =================== */

.page-footer {
  padding: 12px 16px 18px;
  font-size: .75rem;
  color: var(--text-dim);
  text-align: center;
}

/* =================== RESPONSIVE =================== */

/* Tablet ลงมา */
@media (max-width: 900px) {
  .page-wrap {
    padding: 24px 12px 32px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-panel {
    order: -1;
  }

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

  .hero-subtitle {
    max-width: none;
  }
}

/* Navbar + layout มือถือ */
@media (max-width: 760px) {

  .navbar {
    padding: 8px 16px;
  }

  .nav-toggle {
    display: flex;
  }

  /* เมนูหลักเปลี่ยนเป็น mobile panel */
  .nav-links {
    position: absolute;
    top: 60px;
    right: 0;
    width: 100%;
    background: rgba(15,23,42,.96);
    border-top: 1px solid rgba(148,163,184,.25);
    flex-direction: column;
    padding: 14px 0;
    display: none;
    animation: fadeIn .3s ease;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 20px;
    font-size: 1rem;
    width: 100%;
    text-align: left;
  }
}

/* มือถือแนวตั้งทั่วไป */
@media (max-width: 640px) {

  .page-wrap {
    padding: 18px 10px 28px;
  }

  .page-container {
    max-width: 100%;
  }

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

  .hero-buttons {
    justify-content: flex-start;
  }

  .auth-wrap {
    max-width: 100%;
  }

  .auth-card {
    padding: 18px 14px 22px;
    border-radius: 16px;
  }

  .form-row-inline {
    grid-template-columns: 1fr; /* ซ้อนเป็น 1 คอลัมน์บนมือถือ */
  }

  .auth-btn {
    width: 100%;
  }

  .auth-btn-sm {
    width: auto;
  }
}

/* มือถือเล็กมาก */
@media (max-width: 400px) {
  .logo-text-main {
    font-size: 1rem;
  }

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

  .hero-panel {
    padding: 14px;
  }

  .auth-card {
    padding: 16px 12px 20px;
  }
}

/* fade-in สำหรับ mobile menu */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================= HERO LANDING (VIDEO) ================= */

.hero-landing {
  position: relative;
  border-radius: 32px;
  overflow: hidden;
  padding: 80px 32px;
  margin-bottom: 40px;
  background: rgba(4,12,30,.65); /* เพิ่มความอ่านง่าย */
  backdrop-filter: blur(3px);
  box-shadow: 0 24px 60px rgba(15,23,42,.95);
}


.hero-video-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1) contrast(1.05) brightness(.9);
}

.hero-video-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(15,23,42,.1), rgba(15,23,42,.85)),
    linear-gradient(to bottom, rgba(15,23,42,.3), rgba(15,23,42,.96));
}

/* เนื้อหา hero อยู่ด้านบนสุด */
.hero-landing-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hero-landing-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero-landing-subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 24px;
}

.hero-landing-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

/* ปุ่มใหญ่บน hero */
.auth-btn-lg {
  --h: 52px;
  padding-inline: 32px;
  font-size: 1rem;
}

/* ปุ่ม outline สำหรับดาวน์โหลด */
.auth-btn-outline {
  --h: 52px;
  padding-inline: 28px;
  border-radius: 16px;
  font-weight: 700;
  font-size: .95rem;
  color: #e5f0ff;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(148,163,184,.7);
}

.auth-btn-outline:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(148,163,184,.9),
    0 8px 25px rgba(15,23,42,.8);
}

/* ================= NEWS SECTION ================= */

.home-news {
  margin-top: 8px;
}

.home-news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.home-news-header h2 {
  font-size: 1.4rem;
  margin: 0;
}

.home-news-more {
  font-size: .85rem;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56,189,248,.5);
  background: rgba(15,23,42,.8);
}

.home-news-more:hover {
  background: rgba(15,23,42,1);
}

/* การ์ดข่าว */

.home-news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.news-card {
  background: rgba(15,23,42,.96);
  border-radius: 18px;
  border: 1px solid rgba(30,64,175,.6);
  padding: 14px 14px 16px;
  box-shadow: 0 16px 40px rgba(15,23,42,.9);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: #e0f2fe;
  background: rgba(56,189,248,.16);
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid rgba(56,189,248,.4);
}

.news-tag-blue {
  background: rgba(37,99,235,.16);
  border-color: rgba(37,99,235,.5);
}

.news-tag-gold {
  background: rgba(234,179,8,.12);
  border-color: rgba(234,179,8,.6);
  color: #fef9c3;
}

.news-title {
  font-size: 1rem;
  margin: 2px 0;
}

.news-text {
  font-size: .85rem;
  color: var(--text-dim);
  flex: 1;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.news-link {
  color: var(--accent);
  text-decoration: none;
}

/* ===== RESPONSIVE ปรับ hero + news ===== */

@media (max-width: 900px) {
  .hero-landing {
    padding: 60px 20px;
    border-radius: 26px;
  }

  .hero-landing-title {
    font-size: 2.3rem;
  }

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

@media (max-width: 640px) {
  .hero-landing {
    padding: 48px 16px;
    margin-bottom: 28px;
  }

  .hero-landing-title {
    font-size: 1.9rem;
  }

  .hero-landing-subtitle {
    font-size: .9rem;
  }

  .hero-landing-buttons {
    flex-direction: column;
  }

  .auth-btn-lg,
  .auth-btn-outline {
    width: 100%;
    justify-content: center;
  }

  .home-news-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-news-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= DASHBOARD LAYOUT ================= */

.dash-header {
  margin-bottom: 16px;
}

.dash-page-title {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

.dash-page-subtitle {
  margin: 0;
  font-size: .9rem;
  color: var(--text-dim);
}

/* layout: side menu + main */
.dash-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: flex-start;
}

/* ===== Sidebar ===== */

.dash-sidebar {
  background: rgba(9, 16, 35, .98);
  border-radius: 18px;
  border: 1px solid rgba(30, 64, 175, .7);
  box-shadow: 0 18px 40px rgba(15,23,42,.9);
  padding: 10px 10px 12px;
}

.dash-side-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-side-link,
.dash-side-sublink {
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-dim);
  font-size: .9rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background .16s ease, color .16s ease, transform .12s ease;
  text-decoration: none;        /* << เพิ่มบรรทัดนี้ */
}

/* กันไม่ให้ hover / active มีเส้นใต้กลับมา */
.dash-side-link:hover,
.dash-side-link.is-active,
.dash-side-sublink:hover,
.dash-side-sublink.is-active {
  text-decoration: none;
}

/* =====================
   Wiki
   ===================== */
.wiki-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.wiki-sidebar {
  position: sticky;
  top: 90px;
  align-self: start;
}

.wiki-side-card {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
}

.wiki-side-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.wiki-cat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.wiki-cat:hover {
  background: rgba(255,255,255,0.06);
}

.wiki-cat-count {
  font-size: 12px;
  opacity: .8;
}

.wiki-main {
  min-width: 0;
}

.wiki-section {
  margin-bottom: 22px;
}

.wiki-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 10px;
}

.wiki-section-title {
  margin: 0;
}

.wiki-section-sub {
  opacity: .75;
  font-size: 13px;
}

.wiki-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wiki-card {
  display: block;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
}

.wiki-card:hover {
  transform: translateY(-1px);
  transition: 120ms;
  border-color: rgba(255,255,255,0.18);
}

.wiki-card-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.wiki-card-desc {
  opacity: .85;
  line-height: 1.4;
}

.wiki-card-meta {
  margin-top: 10px;
  font-size: 12px;
  opacity: .7;
}

.wiki-empty {
  opacity: .8;
  font-size: 13px;
  padding: 10px 4px;
}

.wiki-article {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
}

.wiki-back {
  text-decoration: none;
  opacity: .9;
}

.wiki-back:hover { opacity: 1; }

.wiki-pill {
  display: inline-block;
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  font-size: 12px;
}

.wiki-updated {
  margin-left: 10px;
  opacity: .75;
  font-size: 12px;
}

.wiki-summary {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  margin-bottom: 14px;
  opacity: .95;
}

.wiki-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.wiki-content table {
  width: 100%;
  border-collapse: collapse;
}

.wiki-content table th,
.wiki-content table td {
  border: 1px solid rgba(255,255,255,0.12);
  padding: 8px;
}

@media (max-width: 900px) {
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-sidebar { position: relative; top: auto; }
  .wiki-grid { grid-template-columns: 1fr; }
}


.dash-side-link span:first-child,
.dash-side-sublink {
  white-space: nowrap;
}

.dash-side-link:hover,
.dash-side-sublink:hover {
  background: rgba(15,23,42,.9);
  color: #e5f0ff;
}

.dash-side-link.is-active {
  background: linear-gradient(90deg,#38bdf8,#3b82f6);
  color: #0b1120;
  font-weight: 600;
  box-shadow: 0 12px 26px rgba(37,99,235,.65);
  transform: translateY(-1px);
}

/* group ตั้งค่า */
.dash-side-group {
  margin-top: 4px;
}

.dash-side-link.has-chevron {
  padding-right: 12px;
}

.dash-chevron {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.7);
  position: relative;
}

.dash-chevron::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-right: 2px solid rgba(148,163,184,.9);
  border-bottom: 2px solid rgba(148,163,184,.9);
  transform: rotate(45deg);
  transition: transform .16s ease;
}

/* หมุนตอนเปิด */
.dash-side-link.has-chevron.open .dash-chevron::before {
  transform: rotate(-135deg) translateY(1px);
}

.dash-side-sub {
  display: none;
  padding-left: 6px;
  margin-top: 2px;
  border-left: 1px solid rgba(51,65,85,.7);
}

.dash-side-sub.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-side-sublink {
  font-size: .85rem;
  padding: 6px 10px;
}

/* ===== Main panels ===== */

.dash-main {
  display: block;
}

/* grid สำหรับการ์ดบนหน้าแรก */
.dash-section-grid {
  display: grid;
  gap: 18px;
}

@media (min-width: 960px) {
  .dash-section-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* การ์ดภายใน panel */
.dash-card {
  background: rgba(9, 16, 35, .98);
  border-radius: 18px;
  border: 1px solid rgba(30, 64, 175, .6);
  box-shadow: 0 18px 42px rgba(15,23,42,.9);
  padding: 14px 18px 12px;
}

.dash-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(51,65,85,.7);
  margin-bottom: 6px;
}

.dash-card-header h2 {
  margin: 0;
  font-size: 1rem;
}

.dash-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(56,189,248,.9), rgba(15,23,42,1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.dash-card-right-badge {
  margin-left: auto;
}

/* แถวข้อมูล */
.dash-card-body {
  display: flex;
  flex-direction: column;
}

.dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  font-size: .9rem;
  border-bottom: 1px solid rgba(30,41,59,.7);
}

.dash-row:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.dash-row-label {
  color: var(--text-dim);
}

.dash-row-value {
  font-weight: 500;
}

/* badge rank + status */
.badge-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #a855f7, #6366f1);
  color: #fff;
  box-shadow: 0 0 12px rgba(129, 140, 248, .65);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .8rem;
}

.badge-status-normal {
  background: rgba(148,163,184,.15);
  color: #e2e8f0;
}

.badge-status-vip {
  background: rgba(22,163,74,.18);
  color: #bbf7d0;
}

.badge-status-gm {
  background: rgba(239, 68, 68, .18);
  color: #fecaca;
}

/* panel ทั่วไป */
.dash-section {
  margin-top: 4px;
  padding: 14px 16px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(148,163,184,.4);
  background: rgba(15,23,42,.8);
}

.dash-section-title {
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.dash-section-desc {
  margin: 0;
  font-size: .85rem;
  color: var(--text-dim);
}

/* ซ่อน/แสดง panel */
.dash-panel {
  display: none;
}

.dash-panel.is-active {
  display: block;
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
  .dash-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dash-sidebar {
    order: 1;
  }

  .dash-main {
    order: 2;
  }
}

/* ===================== LOGO CIRCLE ===================== */

.logo-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.15);
  box-shadow: 0 0 12px rgba(255,255,255,.15);
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* แสงวิ้งๆ */
/* แสงวิ่งผ่านโลโก้ แบบครอบเต็มรูป */
.logo-sheen {
  position: absolute;
  top: 0;
  left: -150%;
  width: 120%;
  height: 100%;
  background: linear-gradient(
      75deg,
      rgba(255,255,255,0) 0%,
      rgba(255,255,255,.45) 50%,
      rgba(255,255,255,0) 100%
  );
  transform: skewX(-25deg);
  opacity: 0;
  animation: logoSheen 3.2s ease-in-out infinite;
  pointer-events: none;
}

/* ครอบรูปเต็ม + วิ่งเนียน */
@keyframes logoSheen {
  0% {
    left: -150%;
    opacity: 0;
  }
  20% {
    opacity: 0;
  }
  40% {
    opacity: .8;
  }
  55% {
    left: 160%;
    opacity: .6;
  }
  70% {
    opacity: 0;
  }
  100% {
    left: 160%;
    opacity: 0;
  }
}

/* ===== Smooth Page Transition ===== */
.fade-out {
    opacity: 0;
    transition: opacity .35s ease;
}

body {
    opacity: 1;
    transition: opacity .35s ease;
}

/* ================= PAGE LOADING BAR ================= */

.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 9999;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  box-shadow: 0 0 10px rgba(56,189,248,.7);
  transition: width .25s ease-out, opacity .2s ease-out;
  opacity: 0;
  pointer-events: none;
}

/* ================= CHAR TABLE (dashboard) ================= */

.char-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 4px;
}

.char-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 640px;
}

.char-table thead tr {
  background: rgba(15,23,42,.98);
}

.char-table th,
.char-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(30,41,59,.8);
  text-align: left;
  white-space: nowrap;
}

.char-table th {
  font-weight: 600;
  color: var(--text-dim);
  font-size: .8rem;
}

.char-table tbody tr:hover {
  background: rgba(15,23,42,.9);
}

.char-badge-online,
.char-badge-offline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.char-badge-online {
  background: rgba(22,163,74,.18);
  color: #bbf7d0;
  border: 1px solid rgba(34,197,94,.7);
}

.char-badge-offline {
  background: rgba(148,163,184,.16);
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.6);
}

/* มือถือ: ให้ table เลื่อนได้ */
@media (max-width: 640px) {
  .char-table {
    min-width: 520px;
  }
}

/* ================= CHAR MODAL (SweetAlert2) ================= */

.char-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  font-size: .85rem;
}

.char-modal-block {
  border-radius: 12px;
  border: 1px solid rgba(30,41,59,.8);
  background: rgba(15,23,42,.9);
  padding: 8px 10px;
}

.char-modal-title {
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.char-modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(51,65,85,.7);
}

.char-modal-row:last-child {
  border-bottom: none;
}

.char-modal-label {
  color: var(--text-dim);
}

.char-modal-value {
  font-weight: 500;
  color: var(--text-main);
}

/* มือถือ */
@media (max-width: 640px) {
  .char-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* =======================
   FORM INPUT (SEO EDITOR)
   ======================= */
.form-input, 
.dash-card-body input[type="text"],
.dash-card-body textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: #fff;
    outline: none;
    font-size: 14px;
    transition: 0.25s;
}

.form-input:focus,
.dash-card-body input[type="text"]:focus,
.dash-card-body textarea:focus {
    border-color: #7A5CFF;
    background: rgba(122,92,255,0.15);
    box-shadow: 0 0 8px rgba(122,92,255,0.4);
}

/* ======================
   TEXTAREA (OG DESCRIPTION)
   ====================== */
.dash-card-body textarea {
    min-height: 90px;
    resize: vertical;
}

/* ======================
   BUTTONS
   ====================== */

.btn-primary {
    background: linear-gradient(90deg, #7A5CFF, #5C3BFF);
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    cursor: pointer;
    transition: 0.25s;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(90deg, #8F75FF, #6C49FF);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(122,92,255,0.35);
}

/* DELETE BUTTON */
.btn-danger {
    background: linear-gradient(90deg, #FF3A3A, #CC0000);
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    cursor: pointer;
    transition: 0.25s;
    margin-top: 12px;
    font-weight: 600;
}

.btn-danger:hover {
    background: linear-gradient(90deg, #FF5555, #E60000);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,0,0,0.35);
}

/* ===== FORM GROUP ===== */
.itemcode-form .form-block {
    margin-bottom: 18px;
}

.itemcode-form label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 600;
    color: #fff;
}

/* ===== INPUT STYLE ===== */
.itemcode-form input[type="text"],
.itemcode-form input[type="number"],
.itemcode-form textarea,
.itemcode-form select {
    width: 100%;
    padding: 10px 13px;
    background: rgba(15, 23, 42, 0.7);
    color: #e5e7eb;
    font-size: .9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .18);
    outline: none;
    transition: 0.25s;
    font-family: inherit;
}

.itemcode-form input:focus,
.itemcode-form textarea:focus,
.itemcode-form select:focus {
    border: 1px solid #60a5fa;
    box-shadow: 0 0 8px rgba(96,165,250,.6);
}

/* ===== ROW INLINE (Item ID + จำนวน) ===== */
.itemcode-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 10px;
}

.itemcode-row label {
    font-size: .85rem;
}

.helper-text {
    color: #94a3b8;
    font-size: .8rem;
}

/* ========== GUILD CELL + VIEW STATUS BUTTON ========== */

/* ช่องกิลด์: รูป + ชื่อเรียงในแถวเดียว */
.guild-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.guild-emblem {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
  background: #020617;
  border: 1px solid rgba(148,163,184,.6);
}

/* ปุ่ม "ดูสถานะ" ในตารางตัวละคร */
.char-view-link {
  border: 0;
  outline: none;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;

  color: #0b1120;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  box-shadow: 0 10px 22px rgba(37,99,235,.55);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

.char-view-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37,99,235,.7);
  filter: brightness(1.02);
}

.char-view-link:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(30,64,175,.7);
  filter: brightness(.98);
}

.char-view-link:focus {
  outline: none;
}

  /* ===== Modal รายชื่อผู้ใช้โค้ด ===== */
  .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15,23,42,0.85);
      display: flex;              /* ให้ flex ทำงานเลย */
      align-items: center;        /* จัดกลางแกนตั้ง */
      justify-content: center;    /* จัดกลางแกนนอน */
      z-index: 9999;
      padding: 20px;
  }

  .modal-box {
      background: rgba(15,23,42,0.98);
      border-radius: 16px;
      border: 1px solid rgba(148,163,184,.4);
      box-shadow: 0 20px 60px rgba(15,23,42,.9);
      max-width: 720px;           /* ลดให้แคบลง จะดูเป็นกล่องกลางจอมากขึ้น */
      width: 100%;
      max-height: 80vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      margin: 0 auto;             /* เผื่อบางเคสให้ center แน่นอน */
  }

  @media (max-width: 640px) {
    .modal-box {
      max-width: 100%;
      border-radius: 14px;
    }
  }

  .modal-header {
      padding: 14px 18px;
      border-bottom: 1px solid rgba(148,163,184,.35);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
  }
  .modal-header h2 {
      margin: 0;
      font-size: 1rem;
  }
  .modal-subtitle {
      margin: 0;
      font-size: .8rem;
      color: var(--text-dim);
  }
  .modal-body {
      padding: 14px 18px 18px;
      overflow: auto;
  }
  .modal-close {
      background: transparent;
      border: 0;
      color: #e5e7eb;
      font-size: 1.2rem;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 999px;
  }
  .modal-close:hover {
      background: rgba(148,163,184,.2);
  }

  /* ===== ตารางรายชื่อผู้ใช้ Item Code (Modal) ===== */
.redeem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 640px; /* ถ้าหน้าจอแคบจะมีสกอร์ลล์แนวนอน */
}

.redeem-table thead tr {
  background: rgba(15,23,42,.98);
}

.redeem-table th,
.redeem-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(30,41,59,.8);
  text-align: left;
  white-space: nowrap;
}

.redeem-table th {
  font-weight: 600;
  color: var(--text-dim);
  font-size: .8rem;
}

/* hover แถว */
.redeem-table tbody tr:hover {
  background: rgba(15,23,42,.9);
}

/* จัดเลขให้ชิดขวา: Account ID, Char ID, เวลาใช้ */
.redeem-table th:nth-child(3),
.redeem-table th:nth-child(4),
.redeem-table th:nth-child(6),
.redeem-table td:nth-child(3),
.redeem-table td:nth-child(4),
.redeem-table td:nth-child(6) {
  text-align: right;
}

/* ===== ตาราง Item Code (admin) ===== */
.itemcode-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.itemcode-table th,
.itemcode-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(30,41,59,.8);
  vertical-align: middle;
}

.itemcode-table th {
  font-size: .78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.itemcode-table tbody tr:hover {
  background: rgba(15,23,42,.9);
}

/* Code + Title */
.ic-code {
  font-weight: 600;
}

.ic-title {
  font-size: .78rem;
  color: var(--text-dim);
}

/* ประเภท */
.ic-type-main {
  font-weight: 500;
}

.ic-type-sub {
  font-size: .75rem;
  color: var(--text-dim);
}

/* Badge หมดอายุ / ใช้งานได้ถึง */
.ic-exp-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .75rem;
}

.ic-exp-badge .ic-exp-label {
  font-weight: 600;
}

.ic-exp-badge .ic-exp-date {
  font-size: .74rem;
  opacity: .9;
}

.ic-exp-badge.ic-expired {
  background: rgba(220,38,38,.15);
  border: 1px solid rgba(248,113,113,.7);
  color: #fecaca;
}

.ic-exp-badge.ic-active {
  background: rgba(22,163,74,.15);
  border: 1px solid rgba(34,197,94,.7);
  color: #bbf7d0;
}

/* ปุ่มจัดการ */
.itemcode-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.itemcode-actions .btn-xxs {
  min-width: 88px;
  justify-content: center;
  display: inline-flex;
}

/* ================= NEWS SECTION ================= */

.home-news {
  margin-top: 24px;
}

.home-news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.home-news-header h2 {
  font-size: 1.4rem;
  color: var(--text-main);
}

.home-news-sub {
  font-size: .9rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.home-news-more {
  font-size: .85rem;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(56,189,248,.55);
  background: radial-gradient(circle at top left, rgba(56,189,248,.2), transparent);
  transition: background .25s ease, transform .15s ease, box-shadow .15s ease;
}
.home-news-more:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(56,189,248,.5), 0 10px 20px rgba(15,23,42,.7);
}

/* filter pills */
.news-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.news-filter-btn {
  font-size: .85rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.3);
  color: var(--text-dim);
  text-decoration: none;
  background: rgba(15,23,42,.85);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .1s ease;
}
.news-filter-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(56,189,248,.8);
}
.news-filter-btn.is-active {
  color: #0f172a;
  background: linear-gradient(to right, var(--accent), var(--accent-strong));
  border-color: transparent;
}

/* grid 3 columns */
.home-news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
}

.news-empty {
  grid-column: 1 / -1;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(148,163,184,.5);
  background: rgba(15,23,42,.95);
  font-size: .9rem;
  color: var(--text-dim);
}

/* card */
.news-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--bg-card);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  position: relative;
  min-height: 240px;
  box-shadow: 0 18px 35px rgba(15,23,42,.66);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.news-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56,189,248,.65);
  box-shadow: 0 22px 45px rgba(15,23,42,.9);
}

/* รูปภาพด้านบน */
.news-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.2);
  transition: transform .6s ease, filter .4s ease;
}
.news-card:hover .news-thumb img {
  transform: scale(1.05);
  filter: saturate(1.4);
}

/* เนื้อหา */
.news-body {
  padding: 10px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
}

.news-tag-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 2px;
}

.news-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: #e0f2fe;
  background: rgba(56,189,248,.16);
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid rgba(56,189,248,.4);
}
.news-tag-blue {
  background: rgba(37,99,235,.16);
  border-color: rgba(37,99,235,.5);
}
.news-tag-gold {
  background: rgba(245,158,11,.15);
  border-color: rgba(245,158,11,.55);
}
.news-tag-green {
  background: rgba(22,163,74,.16);
  border-color: rgba(22,163,74,.55);
}

.news-title {
  margin: 0;
  font-size: .98rem;
  color: var(--text-main);
}
.news-text {
  margin: 0;
  font-size: .82rem;
  color: var(--text-dim);
  line-height: 1.45;
}

/* meta */
.news-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .76rem;
  color: rgba(148,163,184,.9);
}
.news-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* แสงวิ่งผ่าน */
.news-card-shine::before,
.card-shine::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 0%,
    rgba(255,255,255,.06) 45%,
    rgba(255,255,255,.25) 50%,
    rgba(255,255,255,.06) 55%,
    transparent 100%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}
.news-card-shine,
.card-shine {
  position: relative;
  overflow: hidden;
}
.news-card-shine:hover::before,
.card-shine:hover::before {
  opacity: 1;
  transform: translateX(120%);
  transition: transform .9s ease, opacity .4s ease;
}

/* news list page */
.news-list-page {
  margin-top: 24px;
}
.news-list-header h1 {
  font-size: 1.6rem;
  color: var(--text-main);
}
.news-list-header p {
  font-size: .9rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* pagination */
.news-pagination {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.page-pill {
  min-width: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.4);
  color: var(--text-dim);
  text-decoration: none;
  text-align: center;
  font-size: .8rem;
  background: rgba(15,23,42,.9);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.page-pill:hover {
  border-color: rgba(56,189,248,.8);
}
.page-pill.is-active {
  color: #0f172a;
  background: linear-gradient(to right, var(--accent), var(--accent-strong));
  border-color: transparent;
}

/* detail hero */
.news-detail-hero {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  margin-top: 24px;
  padding: 40px 26px;
  background-size: cover;
  background-position: center;
}
.news-detail-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15,23,42,.2), rgba(15,23,42,.9));
}
.news-detail-inner {
  position: relative;
  max-width: 780px;
}
.news-detail-tag {
  font-size: .8rem;
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(56,189,248,.7);
  background: rgba(15,23,42,.8);
  color: var(--accent);
  margin-bottom: 10px;
}
.news-detail-title {
  font-size: 1.6rem;
  margin: 0 0 8px;
  color: #e5f0ff;
}
.news-detail-meta {
  font-size: .85rem;
  color: rgba(226,232,240,.9);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.news-detail-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.news-action-btn {
  border-radius: 999px;
  border: 1px solid rgba(56,189,248,.6);
  background: rgba(15,23,42,.9);
  color: var(--text-main);
  font-size: .85rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: background .18s ease, transform .1s ease, box-shadow .18s ease;
}
.news-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15,23,42,.9);
}

/* detail content */
.news-detail-content {
  margin-top: 24px;
  margin-bottom: 40px;
}
.news-detail-excerpt {
  font-size: .94rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.news-detail-body {
  font-size: .94rem;
  color: var(--text-main);
  line-height: 1.6;
}
.news-detail-body p {
  margin-bottom: 8px;
}

/* social & other */
.news-detail-social {
  margin-top: 28px;
}
.news-detail-social h2,
.news-detail-other h2 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--text-main);
}
.social-links-row,
.other-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.social-card,
.other-card {
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(15,23,42,.98);
  padding: 14px;
  text-decoration: none;
  color: var(--text-main);
  font-size: .9rem;
  box-shadow: 0 14px 30px rgba(15,23,42,.8);
}
.social-label {
  font-size: .78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.social-title {
  font-size: 1rem;
  margin-top: 2px;
}
.social-url {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.other-card h3 {
  font-size: .98rem;
  margin: 0 0 4px;
}
.other-card p {
  margin: 0;
  font-size: .84rem;
  color: var(--text-dim);
}

/* responsive */
@media (max-width: 1024px) {
  .home-news-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  .social-links-row,
  .other-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}
@media (max-width: 680px) {
  .home-news-grid {
    grid-template-columns: minmax(0,1fr);
  }
  .social-links-row,
  .other-grid {
    grid-template-columns: minmax(0,1fr);
  }
  .news-detail-hero {
    padding: 26px 18px;
    border-radius: 20px;
  }
  .news-detail-title {
    font-size: 1.3rem;
  }
}

/* ===== News List Layout ===== */

.dash-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.dash-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--text-soft, #cbd5f5);
  white-space: nowrap;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-soft, #cbd5f5);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.9);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pill:hover {
  border-color: rgba(56, 189, 248, 0.8);
}
.pill.is-active {
  color: #0b1020;
  background: linear-gradient(90deg, var(--accent, #7c3aed), var(--accent-strong, #4c1d95));
  border-color: transparent;
}

/* ตาราง news */
.admin-table-news th,
.admin-table-news td {
  padding: 8px 10px;
  font-size: 0.8rem;
}

.admin-table-news .col-id {
  width: 48px;
  text-align: center;
}
.admin-table-news .col-title {
  width: 32%;
}
.admin-table-news .col-cat,
.admin-table-news .col-status,
.admin-table-news .col-views,
.admin-table-news .col-link,
.admin-table-news .col-actions {
  text-align: center;
}
.admin-table-news .col-publish {
  white-space: nowrap;
}

/* sub text under title */
.news-title-main {
  font-weight: 500;
}
.news-title-sub {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.9);
  margin-top: 2px;
}

/* badge */
.badge-cat {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}
.badge-published {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  border: 1px solid rgba(34, 197, 94, 0.6);
}
.badge-draft {
  background: rgba(148, 163, 184, 0.12);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

/* buttons small */
.btn-ghost-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  font-size: 0.78rem;
  color: var(--text-soft, #cbd5f5);
  text-decoration: none;
}
.btn-ghost-small:hover {
  border-color: rgba(56, 189, 248, 0.9);
}

.btn-small,
.btn-danger-small {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: none;
  cursor: pointer;
}
.btn-small {
  background: linear-gradient(90deg, var(--accent, #7c3aed), var(--accent-strong, #4c1d95));
  color: #0b1020;
}
.btn-danger-small {
  background: #ef4444;
  color: #fff;
}

.inline-form {
  display: inline-block;
  margin: 0 2px;
}

/* มือถือ */
@media (max-width: 900px) {
  .dash-filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==== News New Form ==== */

.dash-news-new .news-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-2 {
  gap: 10px;
}

.form-row-2 .form-col {
  flex: 1 1 0;
}

@media (min-width: 768px) {
  .form-row-2 {
    flex-direction: row;
  }
}

.form-label {
  font-size: 0.85rem;
  color: var(--text-soft, #cbd5f5);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.form-label-sub {
  font-size: 0.75rem;
  color: rgba(148,163,184,0.9);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.4);
  background: rgba(15,23,42,0.96);
  color: var(--text-main, #e5e7eb);
  font-size: 0.85rem;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(56,189,248,0.9);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.6);
  background: rgba(15,23,42,0.98);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

.form-textarea-html {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

/* date / time row */
.form-row-inline {
  margin-top: 4px;
}

.form-inline-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-input-date,
.form-input-time {
  max-width: 180px;
}

.form-hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: rgba(148,163,184,0.96);
}

/* toolbar editor */

.editor-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.35);
  background: radial-gradient(circle at top left, rgba(56,189,248,0.16), rgba(15,23,42,0.98));
}

.tb-btn {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text-soft, #e5e7eb);
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.5);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.tb-btn:hover {
  background: linear-gradient(90deg, var(--accent, #7c3aed), var(--accent-strong, #4c1d95));
  border-color: transparent;
  transform: translateY(-1px);
}
.tb-btn b,
.tb-btn i,
.tb-btn u {
  pointer-events: none;
}

.tb-sep {
  width: 1px;
  height: 20px;
  background: rgba(148,163,184,0.4);
  margin: 0 2px;
}

/* action row */
.form-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* === ปุ่มในส่วนฟอร์มโพสต์ข่าว === */

.form-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* รีเซ็ตไม่ให้ปุ่มกิน width 100% */
.form-row-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 150px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease,
              background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.form-row-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15,23,42,0.9);
}

/* ปุ่มหลัก: เผยแพร่ทันที */
.btn-primary {
  background: linear-gradient(90deg, #6c4cff, #8d5dff);
  color: #0b1020;
}

/* ปุ่มรอง: บันทึกเป็นฉบับร่าง */
.btn-secondary {
  background: rgba(15,23,42,0.95);
  color: #e5e7eb;
  border: 1px solid rgba(148,163,184,0.7);
}

/* ปุ่มขอบ: ตั้งเวลาโพสต์ */
.btn-outline {
  background: transparent;
  color: #e5e7eb;
  border: 1px solid rgba(129,140,248,0.9);
}

/* เอฟเฟกต์ hover เฉพาะปุ่มรอง/ขอบ */
.btn-secondary:hover {
  background: rgba(30,64,175,0.7);
  border-color: rgba(129,140,248,1);
}
.btn-outline:hover {
  background: rgba(79,70,229,0.25);
}

.news-detail-other .news-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .news-detail-other .news-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .news-detail-other .news-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ========== DOWNLOAD PAGE ========== */

.download-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}

.download-header h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.download-header p {
  color: var(--text-dim);
  font-size: .95rem;
}

.download-client-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
}

.download-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.btn-outline {
  background: transparent;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.7);
  color: var(--text-main);
  cursor: pointer;
  transition: 0.25s;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-outline:hover {
  background: rgba(15,23,42,.9);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.download-note-list,
.sysreq-list {
  list-style: disc;
  margin-left: 18px;
  margin-top: 8px;
  color: var(--text-dim);
  font-size: .9rem;
}

.download-note-list li + li,
.sysreq-list li + li {
  margin-top: 4px;
}

.download-sysreq-card {
  margin-top: 4px;
}

.sysreq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.sysreq-title {
  font-size: 1rem;
  margin-bottom: 4px;
}

/* manual patch table ปรับให้ใช้กับ char-table ได้เลย */
.download-table a {
  color: var(--accent-strong);
  text-decoration: none;
}

.download-table a:hover {
  text-decoration: underline;
}

.helper-text.tiny {
  font-size: .8rem;
}

/* Responsive */
@media (max-width: 900px) {
  .download-client-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sysreq-grid {
    grid-template-columns: 1fr;
  }
  .download-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ========== GUILD RANK SECTION ========== */

.guild-rank-section {
  margin-top: 24px;
}

.guild-rank-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.guild-rank-subtext {
  font-size: .9rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.guild-rank-table th,
.guild-rank-table td {
  vertical-align: middle;
}

.guild-rank-pos {
  font-weight: 700;
  text-align: center;
}

.guild-emblem-wrap {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.5);
  background: radial-gradient(circle at 30% 0%, rgba(148,163,184,.35), transparent 55%);
  margin: 0 auto;
}

.guild-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.guild-name-cell .guild-name {
  font-weight: 600;
}

.guild-master,
.guild-members,
.guild-gvg-pts {
  font-size: .9rem;
}

.guild-gvg-pts {
  font-weight: 700;
  color: var(--accent-strong, var(--accent));
}

/* mobile */
@media (max-width: 768px) {
  .guild-rank-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .guild-rank-table th:nth-child(4),
  .guild-rank-table td:nth-child(4) {
    display: none; /* ซ่อนคอลัมน์หัวหน้ากิลด์บนจอเล็ก ถ้ารู้สึกแน่นเกินไป */
  }
}

/* ===== Dashboard Events ===== */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.event-card {
  background: rgba(10, 10, 18, 0.9);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out, border-color 0.18s ease-out;
}

.event-card:hover {
  transform: translateY(-3px);
  border-color: rgba(23, 162, 255, 0.5);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

.event-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.event-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.event-content {
  padding: 14px 16px 16px;
}

.event-title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.event-dates {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.event-dates strong {
  color: var(--text-strong, #fff);
}

.event-actions {
  display: flex;
  justify-content: flex-start;
}

.event-actions .btn-primary {
  padding: 6px 14px;
  font-size: 0.9rem;
  border-radius: 999px;
}


/* ปรับปุ่มเล็กใน admin table */
.admin-table .btn-xs {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  text-decoration: none;
}

.admin-table .btn-xs:hover {
  background: rgba(255,255,255,0.06);
}

.admin-table .btn-xs.btn-danger {
  border-color: rgba(56,189,248,.7);
}

/* ====== Event Form (admin) ====== */

/* กล่องใน form */
.form-grid {
  display: grid;
  gap: 14px;
}

.form-group {
  display: block;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

/* hint ใต้ input */
.form-hint,
.form-group small {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 3px;
  opacity: .9;
}

/* จัด checkbox สวย ๆ */
.form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  color: var(--text-dim);
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ปุ่มด้านล่างฟอร์ม */
.form-actions {
  margin-top: 8px;
}

/* ====== ปรับ input ให้เข้าธีม (เพิ่ม datetime-local + file) ====== */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
select {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.6);
  background: rgba(15,23,42,.75);
  color: var(--text-main);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: .18s ease;
}

/* โฟกัสแล้วมีกรอบฟ้าเหมือน auth form */
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56,189,248,.7);
}

/* ให้ date/datetime-local เป็นโทน dark */
input[type="date"],
input[type="datetime-local"] {
  color-scheme: dark;
}

/* ปรับ file input ให้เนียนขึ้นนิดหน่อย */
input[type="file"] {
  padding: 6px 10px;
  cursor: pointer;
}

/* ===================================================================
   Admin: Wiki (admin/wiki.php)
   - หน้านี้ใช้ class .wiki-admin เพื่อไม่ไปรบกวนหน้าอื่น
   =================================================================== */

.wiki-admin {
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(8, 12, 24, 0.72);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
}

.wiki-admin .dash-section-title {
  margin-bottom: 6px;
}

.wiki-admin .dash-section-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* ปุ่มแบบ admin (แทน class btn ที่หน้าอื่นไม่ใช้) */
.wiki-admin .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.wiki-admin .btn:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(56, 189, 248, 0.12);
}

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

/* ฟอร์ม */
.wiki-admin .label {
  display: block;
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* กัน class="input" (จากหน้าอื่น/บางหน้า) ให้เข้าธีม admin */
.wiki-admin .input,
.wiki-admin input[type="text"],
.wiki-admin input[type="number"],
.wiki-admin select,
.wiki-admin textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: 0.18s ease;
}

.wiki-admin textarea {
  resize: vertical;
  min-height: 84px;
}

.wiki-admin .input:focus,
.wiki-admin input[type="text"]:focus,
.wiki-admin input[type="number"]:focus,
.wiki-admin select:focus,
.wiki-admin textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.75);
}

.wiki-admin .dash-form-grid {
  display: grid;
  gap: 12px;
}

@media (max-width: 980px) {
  .wiki-admin .dash-form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ตารางรายการ */
.wiki-admin .table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.wiki-admin .table thead th {
  position: sticky;
  top: 0;
  background: rgba(3, 8, 20, 0.92);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.wiki-admin .table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  vertical-align: top;
}

.wiki-admin .table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.wiki-admin .table code {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
}

/* badge (draft/published) */
.wiki-admin .badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
}

/* Summernote ให้เข้าธีมมืด */
.wiki-admin .note-editor.note-frame {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.55);
}

.wiki-admin .note-toolbar {
  background: rgba(3, 8, 20, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wiki-admin .note-toolbar .note-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.9);
}

.wiki-admin .note-toolbar .note-btn:hover {
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(56, 189, 248, 0.12);
}

.wiki-admin .note-editor .note-editing-area .note-editable {
  background: rgba(15, 23, 42, 0.75);
  color: rgba(255, 255, 255, 0.92);
}

.wiki-admin .note-editor .note-statusbar {
  background: rgba(3, 8, 20, 0.72);
}

/* ปุ่มบันทึกให้ดูเป็นปุ่มหลักใน card */
.dash-card .form-actions .btn-primary {
  margin-top: 4px;
}

  .admin-table.admin-table-events {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
  }

  .admin-table.admin-table-events thead th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text, #f5f5f5);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
  }

  .admin-table.admin-table-events tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
  }

  .admin-table.admin-table-events tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
  }

  .admin-table.admin-table-events tbody tr:hover {
    background: rgba(255,255,255,0.04);
  }

  .admin-table.admin-table-events td.col-actions {
    white-space: nowrap;
    text-align: right;
  }

  .btn-xs.btn-edit {
    display: inline-block;
    padding: 4px 10px;
    margin-right: 4px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(174, 0, 255, 0.14);
    color: #f5e9ff;
    font-size: 0.78rem;
    text-decoration: none;
  }

  .btn-xs.btn-edit:hover {
    background: rgba(174, 0, 255, 0.28);
  }

  .link-small {
    font-size: 0.8rem;
  }

  .event-image-thumb {
    max-width: 220px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  }

  .current-image-preview {
    margin-top: 6px;
  }
  

  /* ==========================
   POKER CARD (Pure CSS)
   ========================== */

.poker-card {
  width: 76px;
  height: 110px;
  border-radius: 10px;
  background: #fff;
  position: relative;
  border: 2px solid rgba(148,163,184,.4);
  box-shadow: 0 6px 14px rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Kanit', sans-serif;
  color: #111;
  user-select: none;
}

.poker-card.red { color: #e11d48; }
.poker-card.black { color: #111; }

.poker-card .corner {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 14px;
  line-height: 14px;
  text-align: left;
}
.poker-card .corner.bottom {
  top: unset;
  bottom: 4px;
  left: unset;
  right: 6px;
  transform: rotate(180deg);
}

.poker-card .suit-big {
  font-size: 38px;
  opacity: .85;
}

/* Animation (Optional) */
.poker-flip {
  transition: transform .45s ease;
  transform-style: preserve-3d;
}
.poker-flip:hover {
  transform: rotateY(180deg);
}

.poker-card-back {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border: 2px solid #60a5fa;
  box-shadow: inset 0 0 12px rgba(255,255,255,.35);
}

.poker-cards-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:6px;
}
.poker-card{
  width:48px;
  height:64px;
  border-radius:6px;
  border:1px solid rgba(148,163,184,.6);
  background: radial-gradient(circle at 10% 0%, rgba(148,163,184,.25), rgba(15,23,42,1));
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:0.85rem;
  font-weight:600;
}
.poker-card.red{ color:#f97373; }
.poker-card.black{ color:#e5e7eb; }
.poker-card small{ font-size:0.65rem; display:block; opacity:.8; }


/* =================== FOOTER (NEW) =================== */

.site-footer {
  position: relative;
  margin-top: 32px;
  padding: 46px 0 18px;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,0.18), transparent 60%),
    radial-gradient(circle at bottom right, rgba(15,23,42,0.9), transparent 55%),
    linear-gradient(to bottom, #020617, #020617);
  border-top: 1px solid rgba(148,163,184,0.35);
  color: var(--text-main);
  overflow: hidden;
}

/* ===================== STAR PARTICLES ===================== */

.footer-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* จุดพื้นฐาน */
.footer-stars .dot,
.footer-stars .twinkle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.9;
}

/* ------------------- ตำแหน่งเริ่ม (สุ่มแบบกำหนด) ------------------- */
.d1  { left: 8vw;  top: 12vh; }
.d2  { left: 22vw; top: 30vh; }
.d3  { left: 40vw; top: 18vh; }
.d4  { left: 65vw; top: 14vh; }
.d5  { left: 82vw; top: 32vh; }
.d6  { left: 12vw; top: 55vh; }
.d7  { left: 38vw; top: 60vh; }
.d8  { left: 58vw; top: 48vh; }
.d9  { left: 75vw; top: 58vh; }
.d10 { left: 90vw; top: 42vh; }

/* จุดกระพริบ 5 จุด */
.t1 { left: 15vw; top: 20vh; }
.t2 { left: 35vw; top: 40vh; }
.t3 { left: 55vw; top: 25vh; }
.t4 { left: 72vw; top: 15vh; }
.t5 { left: 88vw; top: 50vh; }

/* ------------------- การลอยไปต่างทิศ ------------------- */

.d1  { animation: driftLeftUp 18s linear infinite; }
.d2  { animation: driftRightUp 20s linear infinite; }
.d3  { animation: driftDownLeft 22s linear infinite; }
.d4  { animation: driftDownRight 26s linear infinite; }
.d5  { animation: driftLeftUp 16s linear infinite; }
.d6  { animation: driftRightUp 28s linear infinite; }
.d7  { animation: driftDownRight 24s linear infinite; }
.d8  { animation: driftDownLeft 20s linear infinite; }
.d9  { animation: driftLeftUp 30s linear infinite; }
.d10 { animation: driftRightUp 18s linear infinite; }

/* ------------------- จุดกระพริบ ------------------- */

.twinkle {
  background: var(--accent-strong);
  animation:
    twinkleBlink 1.8s ease-in-out infinite,
    driftTwinkle 25s linear infinite;
}

@keyframes twinkleBlink {
  0%   { opacity: 0.2; transform: scale(0.7); }
  50%  { opacity: 1;   transform: scale(1.8); }
  100% { opacity: 0.3; transform: scale(0.8); }
}

/* ทิศลอยของจุดกระพริบ */
@keyframes driftTwinkle {
  0%   { transform: translate(0,0); }
  100% { transform: translate(180px, -150px); } /* ลอยยาวจนสุดจอ */
}

/* ------------------- Direction Keyframes ------------------- */

/* ลอยซ้ายบน */
@keyframes driftLeftUp {
  0%   { transform: translate(0,0); }
  100% { transform: translate(-220px, -160px); } /* ลอยจนสุดจอ */
}

/* ลอยขวาบน */
@keyframes driftRightUp {
  0%   { transform: translate(0,0); }
  100% { transform: translate(220px, -160px); }
}

/* ลอยลงซ้าย */
@keyframes driftDownLeft {
  0%   { transform: translate(0,0); }
  100% { transform: translate(-220px, 160px); }
}

/* ลอยลงขวา */
@keyframes driftDownRight {
  0%   { transform: translate(0,0); }
  100% { transform: translate(220px, 160px); }
}



/* layout หลักของ footer */
.footer-inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  z-index: 1;
}

.footer-left {
  flex: 1.2;
}

.footer-right {
  flex: 1;
  max-width: 380px;
}

/* text / title */
.footer-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 6px;
}
.footer-title span {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(56,189,248,.9);
}
.footer-desc {
  font-size: 0.95rem;
  color: var(--text-main);
}
.footer-sub {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
  max-width: 460px;
}

/* social */
.footer-social {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}
.footer-sicon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(15,23,42,.85);
  border: 1px solid rgba(148,163,184,.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1rem;
  transition: background .18s ease, border-color .18s ease, transform .12s ease, color .18s ease;
}
.footer-sicon:hover {
  background: radial-gradient(circle at top, var(--accent), rgba(15,23,42,1));
  border-color: rgba(56,189,248,.9);
  color: #0b1120;
  transform: translateY(-2px);
}

/* ขวา: contact + discord */
.footer-contact-title {
  font-size: 1.1rem;
  margin: 0 0 8px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
.footer-email {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.footer-email i {
  margin-right: 6px;
  color: var(--accent);
}

/* กล่องล้อม widget ให้เข้ากับ theme */
.footer-discord-box {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 38px rgba(15,23,42,.95);
  overflow: hidden;
}
.footer-discord-box iframe {
  display: block;
  width: 100%;
  border: none;
}

/* แถวล่างสุด */
.footer-bottom {
  position: relative;
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1px solid rgba(15,23,42,0.9);
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-dim);
  z-index: 1;
}

/* ไม่ใช้ page-footer แบบเก่าแล้ว */
.page-footer {
  display: none;
}

/* responsive */
@media (max-width: 860px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-right {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .site-footer {
    padding: 34px 0 16px;
  }
  .footer-inner {
    padding-inline: 14px;
  }
  .footer-title {
    font-size: 1.5rem;
  }
  .footer-discord-box iframe {
    height: 260px;
  }
}


/* ===== Affiliate Copy Link Box ===== */
.aff-copy-box {
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.35);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.18s ease;
  word-break: break-all;
  user-select: text;
}

.aff-copy-box:hover {
  background: rgba(30,41,59,0.88);
  border-color: rgba(96,165,250,0.7);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

.aff-copy-box code {
  color: #60a5fa;
  font-size: 0.85rem;
}

/* ====== กล่องไอเทมอัปเดตในเนื้อข่าว ====== */
.item-update-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  margin: 16px 0;
  border-radius: 16px;
  background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.26), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.item-update-thumb {
  flex: 0 0 auto;
}

.item-update-thumb img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 12px;
  background: radial-gradient(circle at top, rgba(15,23,42,0.9), rgba(15,23,42,0.3));
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.item-update-body {
  flex: 1 1 auto;
  min-width: 0;
}

.item-update-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #a5b4fc;
  margin-bottom: 2px;
}

.item-update-name {
  font-size: 1rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.item-update-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(248, 250, 252, 0.12);
  font-size: 0.78rem;
  color: #fb923c;
  margin-bottom: 6px;
}

.item-update-desc {
  font-size: 0.9rem;
  color: #cbd5f5;
  line-height: 1.5;
}

/* responsive: มือถือให้รูปเล็กลง / ซ้อนกันสวย ๆ */
@media (max-width: 640px) {
  .item-update-card {
    align-items: flex-start;
  }
  .item-update-thumb img {
    width: 64px;
    height: 64px;
  }
}

/* =========================
   Wiki (Player) Layout
   ========================= */
.wiki-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.wiki-left {
  position: sticky;
  top: 92px;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(10px);
}

.wiki-left-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #e5e7eb;
  letter-spacing: 0.2px;
  margin: 0 0 10px;
}

.wiki-left-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
  margin: 10px 0;
}

.wiki-left-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  border: 1px solid transparent;
}

.wiki-left-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}

.wiki-left-item.is-active {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.32);
  color: #eaf2ff;
}

.wiki-center {
  min-width: 0;
}

.wiki-right {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 12px;
}

.wiki-sidecard {
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(10px);
}

.wiki-sidecard-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.90);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 10px;
}

.wiki-sidecard-meta {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
}

.wiki-toc {
  display: grid;
  gap: 6px;
}

.wiki-toc-item {
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.35;
}

.wiki-toc-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}

.wiki-toc-item.is-sub {
  padding-left: 18px;
  opacity: 0.90;
}

.wiki-page-head {
  margin-bottom: 10px;
}

.wiki-page-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
}

.wiki-page-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.75);
}

.wiki-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.42);
  margin-bottom: 12px;
}

.wiki-filter-title {
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
}

/* responsive */
@media (max-width: 1100px) {
  .wiki-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .wiki-right {
    display: none;
  }
}

@media (max-width: 840px) {
  .wiki-shell {
    grid-template-columns: 1fr;
  }
  .wiki-left {
    position: static;
  }
}

/* ==============================
   Admin Wiki (scoped)
   ============================== */
.wiki-admin .cat-link-pill{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:#fff;
  text-decoration:none;
  font-size:12px;
  line-height:1;
}
.wiki-admin .cat-link-pill:hover{
  background:rgba(255,255,255,.10);
}
.wiki-admin .muted{opacity:.6;}

