/* UI baseline (PHP 5.x + UC Browser friendly)
   Notes:
   - Avoid CSS variables, grid, complex filters.
   - Use simple floats/inline-block + basic media query.
*/

html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #ffffff;
  color: #1b1f23;
}

img { max-width: 100%; border: 0; }
*, *:before, *:after { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }

.ui-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px;
}

/* Divider (used across home/account cards) */
.ui-divider{
  height: 1px;
  background: rgba(44,122,82,0.25);
  margin: 12px 0;
}

/* Header */
.ui-topbar {
  background: #ffffff;
  /* dùng pseudo-element để tránh lỗi "cụt đường" trên một số trang/mobile */
  border-bottom: 0;
  position: relative;
}

/*
  FIX for Topup/User pages:
  topup/assets/theme.css có rule toàn cục `.brand{float:left}` làm sập chiều cao `.ui-topbar`
  (toàn bộ con của .ui-wrap đều float => parent chỉ còn padding ~24px).
  Đè lại float cho brand + thêm clearfix cho .ui-wrap.
*/
.ui-topbar .ui-wrap:after{ content:""; display:block; clear:both; }
.ui-topbar .brand{ float:none; }

.ui-topbar:after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:1px;
  background:#12384f;
}

.ui-topbar .brand {
  display: inline-block;
  font-weight: bold;
  letter-spacing: 0.4px;
  padding: 12px 10px;
  color: #2c7a52;
}

.ui-topbar .nav {
  display: inline-block;
  vertical-align: top;
  padding: 10px 0;
}

.ui-topbar .nav a {
  display: inline-block;
  padding: 8px 10px;
  margin: 0 3px;
  background: #2c7a52;
  border: 1px solid #2c7a52;
  border-radius: 10px;
  font-size: 13px;
  color: #ffffff;
}

.ui-topbar .nav a:hover { opacity: .92; }

.ui-topbar .userbox {
  float: right;
  padding: 10px 10px;
  text-align: right;
}

.ui-topbar .userbox a{ color:#2c7a52; font-weight:bold; }

.ui-pill {
  display: inline-block;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #2c7a52;
  border-radius: 999px;
  font-size: 13px;
  color: #2c7a52;
}

.ui-btn {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  background: #2c7a52;
  border: 1px solid #2c7a52;
  border-radius: 12px;
  color: #ffffff;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
}

.ui-btn:active { opacity: 0.9; }

.ui-btn.secondary {
  background: #103247;
  color: #1b1f23;
  border: 1px solid #2c7a52;
}

/* Right box (Server info): match width with account card */
.ui-card-narrow{ width:auto; margin-left:0; margin-right:0; }

/* Logged-in account card (Trang chủ) */
.ui-profile-head{ padding:4px 2px; }
.ui-profile-name{ overflow:hidden; }
.ui-profile-name .nm{ font-weight:bold; font-size:15px; color:#1b1f23; }
.ui-profile-name .vip{ display:inline-block; margin-left:8px; padding:3px 8px; border:1px solid #2c7a52; border-radius:999px; color:#2c7a52; font-size:12px; vertical-align:2px; background:#ffffff; }
.ui-profile-sub{ margin-top:6px; font-size:12px; color:#1b1f23; }

.ui-subtitle{ font-weight:bold; color:#2c7a52; margin:6px 0 10px; }

.ui-stats{ overflow:hidden; }
.ui-stats .st{ display:inline-block; width:48%; margin:1%; padding:10px 10px; border:1px solid #2c7a52; border-radius:12px; background:#ffffff; }
.ui-stats .st .k{ font-size:12px; color:#1b1f23; }
.ui-stats .st .v{ margin-top:6px; font-weight:bold; color:#1b1f23; }

.ui-actions-2{ margin-top:10px; }
.ui-actions-2 .ui-btn-block{ width:48%; display:inline-block; vertical-align:top; }
.ui-actions-2 .ui-btn-block:first-child{ margin-right:4%; }

.ui-btn.danger {
  background: #ff5a6a;
  color: #ffffff;
}

.ui-grid {
  margin-top: 12px;
}

.ui-col {
  display: inline-block;
  vertical-align: top;
  width: 32%;
}

/* Column ratios (middle slightly wider, left & right equal) */
.ui-col.mid { width: 36%; }
.ui-col.right { width: 32%; }

.ui-col.left .ui-card { margin-left: 0; }
.ui-col.right .ui-card { margin-right: 0; }


.ui-card {
  background: #ffffff;
  border: 1px solid #2c7a52;
  border-radius: 16px;
  padding: 12px;
  margin: 8px 6px;
}

.ui-title {
  font-size: 14px;
  font-weight: bold;
  color: #2c7a52;
  margin-bottom: 10px;
}

.ui-muted { color: #6b7280; font-size: 12px; }

/* Banner */
.ui-banner {
  display:block;
  width:100%;
  background: #ffffff;
  border: 1px solid #2c7a52;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  height: 220px;

  /* Ảnh banner dùng background-image inline -> ép cover + center, không tràn */
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

.ui-banner .slide {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  display: none;
}

.ui-banner .slide.on { display: block; }

.ui-banner .dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
}

.ui-banner .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background: rgba(44,122,82,0.25);
  border-radius: 20px;
}

.ui-banner .dot.on { background: #2c7a52; }

/* Server modal: grid buttons */
.ui-sv-tip{
  background:#0b1320;
  border:1px solid rgba(255,255,255,0.12);
  color:#e5e7eb;
  padding:10px 12px;
  border-radius:12px;
  margin-bottom:10px;
  font-size:13px;
}

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

@media (min-width: 680px){
  .ui-sv-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
}

.ui-sv-btn{
  display:block;
  padding:12px 12px;
  border-radius:14px;
  text-decoration:none;
  border:1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(59,130,246,0.22), rgba(16,185,129,0.18));
  color:#e5f6ff;
}

.ui-sv-btn:hover{ filter: brightness(1.05); }

.ui-sv-btn.disabled{
  opacity:0.55;
  background: rgba(255,255,255,0.06);
  color:#cbd5e1;
  cursor:not-allowed;
}

.ui-sv-name{ font-weight:800; letter-spacing:.2px; }
.ui-sv-sub{ font-size:12px; opacity:.85; margin-top:4px; }

/* Forms */
.ui-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin: 6px 0;
  border-radius: 12px;
  border: 1px solid #2c7a52;
  background: #ffffff;
  color: #1b1f23;
  font-size: 14px;
}

.ui-row { margin-top: 10px; }

/* Remove inline-block gaps so 3 columns won't wrap (Chrome/UC) */
.ui-row{ font-size:0; }
.ui-col{ font-size:14px; }

/* Desktop: use table layout to keep 3 columns stable + equal spacing (UC friendly) */
@media (min-width: 901px){
  .ui-row{
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 12px 0;
    font-size: 14px; /* reset */
  }
  .ui-col{
    display: table-cell;
    vertical-align: top;
    font-size: 14px;
  }
  .ui-col.left{ width: 32%; }
  .ui-col.mid{ width: 36%; }
  .ui-col.right{ width: 32%; }
  /* spacing handled by table border-spacing */
  .ui-card{ margin: 8px 0; }
  .ui-col.left .ui-card{ margin-left: 0; }
  .ui-col.right .ui-card{ margin-right: 0; }
}

/* Logged-in account card (Homepage) */
.ui-profile-head{ margin-top:2px; }
.ui-profile-name{ overflow:hidden; }
.ui-profile-name .nm{ font-size:14px; font-weight:bold; color:#2c7a52; }
.ui-profile-name .vip{
  display:inline-block;
  margin-left:8px;
  padding:4px 8px;
  background:#ffffff;
  border:1px solid #2c7a52;
  border-radius:999px;
  font-size:12px;
  color:#2c7a52;
  font-weight:bold;
}
.ui-profile-sub{ margin-top:6px; font-size:12px; color:#1b1f23; }

.ui-subtitle{ font-weight:bold; color:#2c7a52; margin:6px 0 10px; }

.ui-stats{ font-size:0; }
.ui-stats .st{
  display:inline-block;
  width:48.8%;
  margin:6px 0.6%;
  padding:10px;
  border:1px solid #2c7a52;
  border-radius:12px;
  background:#ffffff;
  vertical-align:top;
}
.ui-stats .st .k{ font-size:12px; color:#2c7a52; }
.ui-stats .st .v{ font-size:13px; font-weight:bold; color:#1b1f23; margin-top:4px; }

.ui-actions-2{ margin-top:8px; font-size:0; }
.ui-actions-2 a{ display:inline-block; width:48.8%; margin:0.6%; }

.ui-card-narrow{ width:auto; margin-left:0; margin-right:0; }

@media (max-width: 880px) {
  /* Mobile: stats 2 cols x 3 rows (as requested) */
  .ui-stats .st{ width:48.8%; margin:6px 0.6%; }
  .ui-card-narrow{ width:100%; margin-left:0; margin-right:0; }
  .ui-login-actions .cell{ width:48.8%; margin:6px 0.6%; }
}

@media (max-width: 420px) {
  /* Keep 2 columns for 6 info cards (2x3) as requested */
  .ui-stats .st{ width:48.8%; margin:6px 0.6%; }
  .ui-login-actions .cell{ width:48.8%; margin:6px 0.6%; }
}

/* Top menu hamburger */
.ui-topbar .nav-toggle{ display:none; float:left; margin-left:0; margin-right:10px; padding:8px 10px; border:1px solid #2c7a52; border-radius:10px; color:#2c7a52; background:#fff; }
@media (max-width: 760px){
  .ui-topbar .nav-toggle{ display:inline-block; }
  .ui-topbar .nav{ display:none; float:none; width:100%; padding-top:8px; }
  .ui-topbar .nav.open{ display:block; }
  .ui-topbar .nav a{ display:block; margin:6px 0; }
}

/* Server metrics */
.metric {
  margin: 10px 0;
}

.metric .label {
  font-size: 12px;
  color: #a7c3d8;
  margin-bottom: 6px;
}

.metric .bar {
  height: 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #2c7a52;
  overflow: hidden;
}

.metric .fill {
  height: 10px;
  width: 0;
  background: #12a66a;
}

.gauge {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  border: 2px solid #1b5673;
  position: relative;
  margin: 6px auto 0;
}

.gauge .center {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  line-height: 96px;
  font-weight: bold;
  color: #2c7a52;
}

.gauge .dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: #bdf7d0;
  position: absolute;
  left: 50%;
  top: 4px;
  margin-left: -5px;
}

/* Mobile / UC: stack 3 columns full width
   NOTE: .ui-col.mid/.right have more specific width rules (36%/32%),
   so we override them explicitly to avoid cards being "hẹp".
*/
@media (max-width: 900px) {
  .ui-row{ font-size:14px; } /* cancel global font-size:0 hack on mobile */
  .ui-col,
  .ui-col.left,
  .ui-col.mid,
  .ui-col.right{
    width: 100% !important;
    display: block;
  }
  .ui-card{ margin: 8px 0; }
  .ui-topbar .userbox { float: none; text-align: left; padding-top: 0; }
  .ui-banner { height: 170px; }
}

/* Server card: prevent "hụt" / tràn trên mobile */
@media (max-width: 520px){
  .ui-server-top{ display:block; }
  .ui-server-img{ display:block; width:100%; height:auto; padding:14px 0; }
  .ui-server-meta{ display:block; padding-left:0; padding-top:10px; }
}


/* Buttons variants */
.ui-btn-ghost {
  background: #ffffff;
  border: 1px solid #2c7a52;
  color: #2c7a52;
}

.ui-btn-sm {
  padding: 8px 9px;
  border-radius: 10px;
  font-size: 13px;
}


/* Home: server info blocks */
.ui-login-actions {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 10px 0;
  margin-top: 6px;
}
.ui-login-actions .cell { display: table-cell; width: 50%; vertical-align: top; }
@media (max-width: 520px) {
  .ui-login-actions { display: block; border-spacing: 0; }
  .ui-login-actions .cell { display: block; width: 100%; }
  .ui-login-actions .cell + .cell { margin-top: 10px; }
}

/* Mobile/UC: avoid "hụt" khung server info (stack blocks) */
@media (max-width: 520px){
  .ui-server-top{ display:block; }
  .ui-server-img{
    display:block;
    width:100%;
    height:auto;
    padding:14px 0;
  }
  .ui-server-meta{ display:block; padding-left:0; padding-top:10px; }
}
.ui-btn-block { display:block; width:100%; }

.ui-check {
  font-size: 12px;
  color: #111827;
  margin: 6px 0;
}
.ui-check input { vertical-align: middle; }

.ui-social {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 10px 0;
  margin-top: 10px;
}
.ui-social a {
  display: table-cell;
  text-align: center;
  padding: 10px 0;
  border: 1px solid #2c7a52;
  border-radius: 12px;
  color: #111827;
  font-weight: bold;
  background: #ffffff;
}

.ui-server-top {
  display: table;
  width: 100%;
  margin-bottom: 10px;
}
.ui-server-img {
  display: table-cell;
  width: 92px;
  height: 92px;
  vertical-align: middle;
  text-align: center;
  border: 1px solid #2c7a52;
  border-radius: 14px;
  color: #111827;
  font-weight: bold;
}
.ui-server-meta {
  display: table-cell;
  vertical-align: top;
  padding-left: 10px;
}
.ui-server-meta .ui-btn { margin-top: 6px; }
.ui-server-name {
  display: block;
  border: 1px solid #2c7a52;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: bold;
  color: #111827;
  margin-bottom: 6px;
}
.ui-server-time {
  display: block;
  border: 1px solid #2c7a52;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 12px;
  color: #111827;
  margin-bottom: 8px;
}
.ui-section-title {
  clear: both;
  margin: 12px 0 8px;
  font-weight: bold;
  color: #111827;
  text-align: center;
  letter-spacing: .5px;
}

.ui-metric {
  display: table;
  width: 100%;
  margin: 10px 0;
}
.ui-metric-circle {
  display: table-cell;
  width: 58px;
  height: 58px;
  vertical-align: middle;
  text-align: center;
  border: 1px solid #2c7a52;
  border-radius: 999px;
  font-weight: bold;
  color: #2c7a52;
}
.ui-metric-body {
  display: table-cell;
  vertical-align: middle;
  padding-left: 10px;
}
.ui-metric-label {
  font-weight: bold;
  color: #111827;
  margin-bottom: 4px;
}
.ui-metric-bar {
  height: 12px;
  border: 1px solid #2c7a52;
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
}
.ui-metric-bar span {
  display: block;
  height: 100%;
  background: rgba(44,122,82,0.25);
}

/* ===== Thế lực Tam Quốc ===== */
.ui-force-title{
  text-align:center;
  font-weight:800;
  letter-spacing:.6px;
  color:#111827;
  margin:0 0 12px;
}
.ui-force-row{
  display: table;
  width: 100%;
  margin: 10px 0;
}
.ui-force-badge{
  display: table-cell;
  width: 44px;
  height: 44px;
  vertical-align: middle;
  text-align: center;
  border-radius: 999px;
  font-weight: 800;
  color: #fff;
  font-size: 12px;
}
.ui-force-bars{
  display: table-cell;
  vertical-align: middle;
  padding-left: 12px;
}
.ui-force-bar{ margin-bottom: 8px; }
.ui-force-bar:last-child{ margin-bottom: 0; }
.ui-force-bar .lb{ font-size: 12px; color:#111827; margin-bottom:4px; }
.ui-force-bar .bar{
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(17,24,39,.25);
  background:#fff;
}
.ui-force-bar .bar span{ display:block; height:100%; }
.ui-force-bar .bar em{
  position:absolute;
  left:10px;
  right:10px;
  top:0;
  height:18px;
  line-height:18px;
  font-size:12px;
  font-weight:700;
  color:#111827;
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}


/* Colors by nation */
.force-1 .ui-force-badge{ background:#1f6feb; }
.force-2 .ui-force-badge{ background:#c05621; }
.force-3 .ui-force-badge{ background:#16a34a; }

.force-1 .ui-force-bar .bar span{ background: rgba(31,111,235,.35); }
.force-2 .ui-force-bar .bar span{ background: rgba(192,86,33,.35); }
.force-3 .ui-force-bar .bar span{ background: rgba(22,163,74,.35); }

/* Sức mạnh: bar đậm hơn */
.ui-force-bar .bar.sm{ border-color: rgba(17,24,39,.35); }
.force-1 .ui-force-bar .bar.sm span{ background: rgba(31,111,235,.55); }
.force-2 .ui-force-bar .bar.sm span{ background: rgba(192,86,33,.55); }
.force-3 .ui-force-bar .bar.sm span{ background: rgba(22,163,74,.55); }

/* ===== Top chăm chỉ ===== */
.ui-topcare-card{
  /* Cho khung TOP Chăm Chỉ cao hơn để "bằng chân" với các khung còn lại (PC) */
  min-height: auto;
}
.ui-topcare-row{
  display: table;
  width: 100%;
  margin: 8px 0;
}
.ui-topcare-badge{
  display: table-cell;
  width: 56px;
  height: 26px;
  vertical-align: middle;
  text-align: center;
  /* Hình chữ nhật bo góc (thay cho hình tròn) */
  border-radius: 10px;
  font-weight: 800;
  color: #fff;
  font-size: 12px;
}
.ui-topcare-name{
  display: table-cell;
  vertical-align: middle;
  font-weight: 800;
  padding-left: 10px;
  font-size: 15px;
}
.ui-topcare-score{ display:none; }
.force-1 .ui-topcare-badge{ background:#1f6feb; }
.force-2 .ui-topcare-badge{ background:#c05621; }
.force-3 .ui-topcare-badge{ background:#16a34a; }
.force-1 .ui-topcare-name{ color:#1f6feb; }
.force-2 .ui-topcare-name{ color:#c05621; }
.force-3 .ui-topcare-name{ color:#16a34a; }

/* FIX: TOP CHĂM CHỈ co sát nội dung */
.top-cham-chi,
.top-care,
.box-top-care {
    min-height: auto !important;
    height: auto !important;
    padding-bottom: 12px;
}

/* Modal (Đăng ký / Chọn server)
   IMPORTANT: scope styles to modal only (không ghi đè .ui-btn toàn site)
*/
.ui-modal-backdrop{display:none;position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.65);z-index:9998}
.ui-modal{display:none;position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);width:92%;max-width:420px;background:#0b1220;border:1px solid rgba(255,255,255,.08);border-radius:16px;box-shadow:0 20px 60px rgba(0,0,0,.55);z-index:9999}
.ui-modal.open,.ui-modal-backdrop.open{display:block}
.ui-modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid rgba(255,255,255,.08)}
.ui-modal-title{font-weight:900;font-size:16px;color:#e5eefc}
.ui-modal-x{color:rgba(255,255,255,.75);text-decoration:none;font-size:22px;line-height:22px;padding:4px 8px;border-radius:10px}
.ui-modal-x:active{background:rgba(255,255,255,.07)}
.ui-modal-body{padding:14px}

.ui-modal .ui-field label{display:block;margin-bottom:6px;font-weight:700;color:rgba(255,255,255,.82)}
.ui-modal .ui-field input{width:100%;padding:10px 12px;border-radius:12px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.04);color:#fff;outline:none}
.ui-modal .ui-field input:focus{border-color:rgba(0,255,153,.38)}
.ui-modal .ui-tip{padding:10px 12px;border-radius:12px;margin-bottom:10px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.10);color:#eaf2ff}
.ui-modal .ui-btn{border:0;border-radius:12px;padding:10px 12px;font-weight:900;cursor:pointer;background:linear-gradient(90deg,rgba(0,255,153,.85),rgba(0,173,255,.85));color:#062016}
.ui-modal .ui-btn:active{transform:translateY(1px)}
.ui-modal .ui-btn-ghost{background:rgba(255,255,255,.06);color:#e5eefc;border:1px solid rgba(255,255,255,.12)}

/* Server modal */
.ui-modal.server{max-width:560px}
.ui-modal.server .ui-modal-body{padding:14px}

.topbar .brand img {
  display:block;
  height:34px;
  max-height:34px;
  width:auto;
  max-width:140px;
  object-fit:contain;
}

.ui-topbar .brand img {
  display:inline-block;
  height:34px;
  max-height:34px;
  width:auto;
  max-width:160px;
  object-fit:contain;
  vertical-align:middle;
}


/* ===== Topup modal ===== */
.ui-modal.topup{max-width:980px;width:96%;background:#ffffff;color:#102018}
.ui-modal.topup .ui-modal-head{border-bottom:1px solid rgba(16,32,24,.12)}
.ui-modal.topup .ui-modal-title{color:#102018}
.ui-modal.topup .ui-modal-x{color:rgba(16,32,24,.75)}
.ui-modal.topup .ui-modal-body-nopad{padding:0}
.ui-topup-frame{width:100%;height:78vh;display:block;border:0;border-radius:0 0 16px 16px;background:#fff}
.ui-topup-tip{padding:10px 12px;border-bottom:1px solid rgba(16,32,24,.10);font-weight:700;color:#1b7a39}
@media (max-width:520px){
  .ui-topup-frame{height:82vh}
}
