/* MUXeon Portal — ธีมทองดำ (black-gold chrome)
   พื้นฐาน: พื้นหลังเข้ม + ลาย gradient ทอง ไม่พึ่งรูปจากภายนอก (วาง assets/img/portal-bg.jpg ทับได้) */

:root {
  --bg: #0b0a08;
  --bg-2: #12100b;
  --panel: #16130d;
  --panel-2: #1c1810;
  --line: #2c2517;
  --line-2: #3d3320;
  --gold: #c9a45c;
  --gold-2: #e9cf8f;
  --gold-3: #f5e3ae;
  --gold-dim: #8a6a2e;
  --text: #e8e2d4;
  --muted: #9a8f78;
  --danger: #d46a5a;
  --ok: #7fbf7f;
  --radius: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .55);
  --font: "Leelawadee UI", "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

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

html { scroll-behavior: smooth; }

body.portal-page {
  min-height: 100vh;
  background-color: var(--bg);
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

.portal-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 500px at 50% -80px, rgba(201, 164, 92, .16), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(120, 60, 20, .10), transparent 55%),
    linear-gradient(180deg, rgba(5, 4, 3, .55), rgba(5, 4, 3, .78));
  z-index: 0;
}

.portal-header, main, .portal-footer { position: relative; z-index: 1; }

/* ---------- Header ---------- */

.portal-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(10, 8, 5, .95), rgba(10, 8, 5, .78));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
}

.portal-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gold-2);
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 1px;
}

.portal-wordmark .wordmark-crest, .crest-svg { width: 34px; height: 34px; }
.portal-wordmark .wordmark-crest { filter: drop-shadow(0 0 6px rgba(201, 164, 92, .45)); }

.portal-nav { display: flex; gap: 4px; margin-left: auto; }

.portal-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 14px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.portal-nav a span { font-size: 10px; letter-spacing: 2px; color: var(--muted); font-weight: 500; }
.portal-nav a:hover, .portal-nav a.active { color: var(--gold-2); border-bottom-color: var(--gold); }
.portal-nav a:hover span, .portal-nav a.active span { color: var(--gold-dim); }

.portal-account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-2);
}

.portal-account-chip small { color: var(--muted); font-weight: 500; }

.portal-menu-button {
  display: none;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--gold-2);
  padding: 8px;
  cursor: pointer;
}

.portal-mobile-menu {
  display: grid;
  gap: 2px;
  padding: 10px 20px 16px;
  background: rgba(10, 8, 5, .96);
  border-bottom: 1px solid var(--line);
}

.portal-mobile-menu a { color: var(--text); text-decoration: none; padding: 10px 12px; border-left: 2px solid var(--line-2); }
.portal-mobile-menu a:hover { color: var(--gold-2); border-left-color: var(--gold); }

/* ---------- Hero / Intro ---------- */

.portal-intro {
  text-align: center;
  padding: 52px 20px 34px;
  max-width: 860px;
  margin: 0 auto;
}

.portal-tagline {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--gold);
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 16px;
  background: rgba(201, 164, 92, .06);
}

.portal-intro .portal-crest { width: 108px; height: 108px; margin: 20px auto 8px; display: block; filter: drop-shadow(0 8px 26px rgba(201, 164, 92, .35)); }

.portal-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 74px);
  color: var(--gold-3);
  letter-spacing: 3px;
  text-shadow: 0 2px 0 #4a3413, 0 10px 34px rgba(201, 164, 92, .35);
}

.portal-intro h1 em { font-style: normal; color: var(--gold); }

.portal-intro p { color: var(--muted); max-width: 560px; margin: 10px auto 0; }

.intro-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  color: var(--gold-dim);
  font-size: 11px;
  letter-spacing: 3px;
}

.intro-rule span:first-child, .intro-rule span:last-child {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

/* ---------- Grid ---------- */

.portal-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 20px;
  width: min(1280px, 100% - 40px);
  margin: 0 auto;
  align-items: start;
}

.portal-left-column, .portal-right-column, .portal-center-column { display: grid; gap: 16px; }

/* ---------- Panels ---------- */

.portal-panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.portal-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(201, 164, 92, .08), transparent);
}

.portal-panel-heading h2 { font-size: 17px; color: var(--gold-2); }
.panel-kicker { font-size: 10px; letter-spacing: 3px; color: var(--gold-dim); }

.panel-corner {
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  opacity: .7;
}

/* ---------- Left column ---------- */

.download-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #241c0e, #171208);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--gold-2);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.download-card:hover { border-color: var(--gold); }

.download-mark {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(201, 164, 92, .1);
}

.download-card strong { display: block; font-size: 15px; }
.download-card span { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.download-card .dl-arrow { margin-left: auto; color: var(--gold); }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.quick-actions a {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.quick-actions a small { color: var(--muted); font-size: 9px; letter-spacing: 2px; }
.quick-actions a:hover { border-color: var(--gold-dim); color: var(--gold-2); }

/* ---------- Login / account card ---------- */

.login-card { display: grid; gap: 10px; padding: 16px; }

.login-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--gold-2); }
.login-card > span.sub { font-size: 10px; letter-spacing: 3px; color: var(--gold-dim); }

.login-card input, .portal-form input, .portal-form select {
  width: 100%;
  padding: 10px 12px;
  background: #0d0b07;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.login-card input:focus, .portal-form input:focus, .portal-form select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 164, 92, .15);
}

.login-card button, .portal-primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-dim));
  border: none;
  border-radius: 7px;
  color: #241a08;
  font-weight: 800;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s;
}

.login-card button:hover, .portal-primary-button:hover { filter: brightness(1.08); }
.login-card button:disabled, .portal-primary-button:disabled { opacity: .55; cursor: wait; }

.ghost-button {
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ghost-button:hover { color: var(--gold-2); border-color: var(--gold-dim); }

.account-rows { display: grid; gap: 8px; font-size: 13px; }
.account-rows .row { display: flex; justify-content: space-between; color: var(--muted); }
.account-rows .row b { color: var(--gold-2); }

/* ---------- Server status ---------- */

.mini-server-card { padding: 14px 16px; display: grid; gap: 8px; }
.mini-server-card > div:first-child { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 3px; color: var(--muted); }
.mini-server-card strong { font-size: 18px; color: var(--ok); letter-spacing: 1px; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); display: inline-block; animation: pulse 2s infinite; }

@keyframes pulse { 50% { opacity: .45; } }

.server-stat-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.server-stat-row b { color: var(--text); }

/* ---------- News ---------- */

.news-list { display: grid; }

.news-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}

.news-row:last-child { border-bottom: none; }
.news-row:hover { background: rgba(201, 164, 92, .05); }

.news-thumb {
  width: 92px;
  min-height: 64px;
  flex: none;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 26px;
  color: rgba(245, 227, 174, .8);
}

.news-thumb.tag-UPDATE { background: linear-gradient(135deg, #2a2110, #14100a); }
.news-thumb.tag-EVENT { background: linear-gradient(135deg, #332211, #150e08); }
.news-thumb.tag-NOTICE { background: linear-gradient(135deg, #102028, #0a1216); }
.news-thumb.tag-GUIDE { background: linear-gradient(135deg, #241016, #140a0d); }

.news-copy { display: grid; gap: 6px; min-width: 0; }
.news-meta { display: flex; gap: 10px; align-items: center; }

.news-tag {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 800;
  color: #241a08;
  background: var(--gold);
  border-radius: 3px;
  padding: 2px 7px;
}

.news-date { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.news-copy h3 { font-size: 14.5px; color: var(--text); line-height: 1.45; }
.news-copy p { font-size: 12px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.news-arrow { margin-left: auto; align-self: center; color: var(--gold-dim); flex: none; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }

.pagination button {
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  color: var(--gold-2);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
}

.pagination button:hover:not(:disabled) { border-color: var(--gold); }
.pagination button:disabled { opacity: .35; cursor: default; }
.pagination span { font-size: 12px; color: var(--muted); }

.news-detail-body { padding: 18px; display: grid; gap: 12px; }
.news-detail-body .news-date { font-size: 12px; }
.news-detail-body .news-body { color: var(--text); font-size: 14px; white-space: pre-line; }

/* ---------- Event card ---------- */

.event-card { padding: 14px; display: grid; gap: 12px; }

.event-art {
  height: 110px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(300px 120px at 70% 20%, rgba(201, 164, 92, .35), transparent 70%),
    linear-gradient(140deg, #2b2110 0%, #17110a 55%, #241708 100%);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  color: rgba(245, 227, 174, .85);
  letter-spacing: 6px;
  font-size: 15px;
}

.event-label { display: flex; gap: 6px; align-items: center; font-size: 10px; letter-spacing: 3px; color: var(--gold); }
.event-content h3 { font-size: 16px; color: var(--gold-2); margin: 4px 0 6px; }
.event-content p { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

.event-more { color: var(--gold-2); font-size: 13px; font-weight: 700; text-decoration: none; }
.event-more:hover { text-decoration: underline; }

/* ---------- Ranking ---------- */

.rank-head, .portal-rank-row {
  display: grid;
  grid-template-columns: 40px 1fr 70px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
}

.rank-head { font-size: 10px; letter-spacing: 2px; color: var(--muted); border-bottom: 1px solid var(--line); }
.portal-rank-row { border-bottom: 1px solid rgba(44, 37, 23, .5); }
.portal-rank-row:last-of-type { border-bottom: none; }
.portal-rank-row:hover { background: rgba(201, 164, 92, .05); }

.rank-number { font-family: var(--font-display); font-size: 17px; color: var(--gold-dim); }
.portal-rank-row:first-of-type .rank-number, .portal-rank-row:nth-of-type(2) .rank-number, .portal-rank-row:nth-of-type(3) .rank-number { color: var(--gold-2); }

.rank-player strong { display: block; font-size: 13.5px; }
.rank-player small { color: var(--muted); font-size: 11px; }
.rank-points { text-align: right; color: var(--gold-2); font-weight: 700; font-size: 13px; }

.rank-more { display: block; text-align: center; padding: 10px; font-size: 12px; color: var(--muted); text-decoration: none; border-top: 1px solid var(--line); }
.rank-more:hover { color: var(--gold-2); }

.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th { font-size: 10px; letter-spacing: 2px; color: var(--muted); text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ranking-table td { padding: 11px 14px; border-bottom: 1px solid rgba(44, 37, 23, .5); font-size: 14px; }
.ranking-table tr:hover td { background: rgba(201, 164, 92, .05); }
.ranking-table .gold { color: var(--gold-2); font-weight: 700; }

/* ---------- Utility nav ---------- */

.utility-nav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  width: min(1280px, 100% - 40px);
  margin: 22px auto 0;
}

.utility-nav a {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}

.utility-nav a span { font-size: 9px; letter-spacing: 2px; color: var(--muted); }
.utility-nav a:hover { border-color: var(--gold-dim); color: var(--gold-2); }

/* ---------- Footer ---------- */

.portal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 44px;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  background: rgba(8, 7, 5, .8);
}

.portal-footer strong { color: var(--gold-2); margin-right: 10px; }
.portal-footer span { color: var(--muted); font-size: 12px; }
.socials { display: flex; gap: 8px; }

.socials a {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--gold-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.socials a:hover { border-color: var(--gold); }

/* ---------- Form pages ---------- */

.portal-form-wrap { width: min(1100px, 100% - 40px); margin: 24px auto 40px; }

.form-breadcrumb { display: flex; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.form-breadcrumb a { color: var(--gold-2); text-decoration: none; }

.form-layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 26px;
  align-items: start;
}

.form-copy { padding-top: 20px; }
.form-copy .form-crest { width: 76px; height: 76px; margin: 18px 0 10px; }

.form-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 42px);
  color: var(--gold-3);
  line-height: 1.15;
}

.form-copy h1 span { color: var(--gold); }
.form-copy p { color: var(--muted); margin-top: 10px; max-width: 420px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--gold-2); }

.portal-form-card { padding: 20px; }

.form-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.form-card-head h2 { font-size: 17px; color: var(--gold-2); }

.secure-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: 2px;
  color: var(--ok); border: 1px solid rgba(127, 191, 127, .4);
  border-radius: 999px; padding: 4px 10px;
}

.portal-form { display: grid; gap: 14px; }
.portal-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.portal-form .hint { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.portal-form .field-error { font-weight: 400; font-size: 12px; color: var(--danger); }

.check-line { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 13px; }
.check-line input { width: auto; }

.topup-packages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.topup-packages label { position: relative; }

.topup-packages input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.topup-packages .pkg {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 4px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #0d0b07;
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
}

.topup-packages .pkg small { color: var(--muted); font-size: 10px; font-weight: 500; }
.topup-packages input:checked + .pkg { border-color: var(--gold); background: rgba(201, 164, 92, .12); color: var(--gold-3); }
.topup-packages input:focus-visible + .pkg { box-shadow: 0 0 0 3px rgba(201, 164, 92, .2); }

.form-security {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

.reference-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  background: rgba(201, 164, 92, .07);
  display: grid;
  gap: 4px;
}

.reference-box strong { color: var(--gold-2); font-size: 16px; letter-spacing: 1px; }
.reference-box span { font-size: 12px; color: var(--muted); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  border: 1px solid;
}

.toast-success { background: #101a10; border-color: rgba(127, 191, 127, .5); color: #c9e8c9; }
.toast-error { background: #1c100e; border-color: rgba(212, 106, 90, .5); color: #f0c5bd; }

.toast-close { background: none; border: none; color: inherit; font-size: 18px; cursor: pointer; line-height: 1; }

.db-warning {
  margin: 14px auto;
  width: min(1280px, 100% - 40px);
  padding: 10px 14px;
  border: 1px solid rgba(212, 106, 90, .5);
  background: #1c100e;
  color: #f0c5bd;
  border-radius: 8px;
  font-size: 13px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .portal-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .portal-right-column { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .utility-nav { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .portal-nav { display: none; }
  .portal-account-chip { margin-left: auto; }
  .portal-menu-button { display: grid; place-items: center; }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-right-column { grid-template-columns: 1fr; }
  .form-layout { grid-template-columns: 1fr; }
  .portal-footer { flex-direction: column; text-align: center; }
}

@media (max-width: 560px) {
  .portal-header { padding: 12px 16px; gap: 10px; }
  .portal-wordmark { font-size: 19px; }
  .utility-nav { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .topup-packages { grid-template-columns: repeat(2, 1fr); }
  .news-thumb { width: 64px; }
}
