
    :root {
      --text-white: #FFFFFF;
      --text-gold: #F3A183;
      --text-muted: #8DA1CB;
      --neon-cyan: #00E5FF;
      --neon-pink: #FF2A85;
      --pink-magenta: #E91E63;
      --rose-gold: #F3A183;
      
      --glass-bg: linear-gradient(135deg, rgba(20, 45, 95, 0.55) 0%, rgba(8, 18, 45, 0.75) 100%);
      --glass-bevel: inset 1px 1px 2px rgba(255, 255, 255, 0.35), inset -1px -1px 4px rgba(0, 0, 0, 0.7);
      
      /* Rose Gold / Pink Borders & Glows */
      --glass-border: 1.5px solid rgba(243, 161, 131, 0.75);
      --gold-border: 1.5px solid rgba(243, 161, 131, 0.85);
      --pink-glow: 0 0 20px rgba(255, 42, 133, 0.5), 0 0 35px rgba(243, 161, 131, 0.25);
      
      --gold-metallic: linear-gradient(180deg, #FFFFFF 0%, #F3A183 45%, #C26342 100%);
      --rose-metallic-btn: linear-gradient(180deg, #FAD0C4 0%, #F3A183 40%, #B85233 100%);
      --font-numbers: 'Rajdhani', sans-serif;
      --font-thai: 'Prompt', sans-serif;

      /* ความกว้างของพื้นที่แสดงผลจริงของแอป — ที่เดียวที่กำหนดค่านี้
         ทุกอย่างที่ต้องกว้างเท่าตัวแอป (เช่นแถบข่าววิ่งที่เป็น position:fixed)
         ต้องอ้างตัวแปรนี้ ไม่ใช่เขียนเลขซ้ำ ไม่งั้นแก้ที่เดียวแล้วอีกที่ไม่ตาม */
      --app-width: 420px;
    }

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

    body {
      background-color: #020409;
      font-family: var(--font-thai);
      color: var(--text-white);
      -webkit-font-smoothing: antialiased;
      overflow-x: hidden;
      display: flex;
      justify-content: center;
      min-height: 100vh;
    }

    #app-wrapper {
      max-width: var(--app-width);
      width: 100%;
      margin: 0 auto;
      min-height: 100vh;
      position: relative;
      overflow-x: hidden;
      background: 
        radial-gradient(circle at 50% 15%, rgba(0, 229, 255, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 80% 60%, rgba(243, 161, 131, 0.15) 0%, transparent 50%),
        linear-gradient(165deg, #0d1b40 0%, #050d21 50%, #020612 100%);
      padding-bottom: 90px;
      box-shadow: 0 0 70px rgba(0, 0, 0, 0.95);
    }

    /* Cosmic Particle Overlay */
    #app-wrapper::before {
      content: "";
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      background-image: 
        radial-gradient(1.5px 1.5px at 25px 35px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 50px 85px, rgba(0,229,255,0.8), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 140px, rgba(243,161,131,0.8), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 160px 50px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 230px 190px, rgba(243,161,131,0.8), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 290px 100px, rgba(255,255,255,0.8), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 360px 220px, rgba(0,229,255,0.6), rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 110px 270px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 380px 320px, rgba(255,255,255,0.6), rgba(0,0,0,0));
      background-size: 380px 480px;
      opacity: 0.5;
      pointer-events: none;
      z-index: 1;
    }

    .app-content {
      position: relative;
      z-index: 2;
    }

    /* 3D Metallic Number Styling */
    .metallic-number {
      font-family: var(--font-numbers);
      background: var(--gold-metallic);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6)) drop-shadow(0 0 10px rgba(243, 161, 131, 0.4));
      font-weight: 700;
    }

    /* 1. Header */
    header {
      padding: 16px 20px 10px 20px;
    }

    .main-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

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

    .brand-text {
      display: flex;
      flex-direction: column;
    }

    .brand-title {
      font-size: 10px;
      color: var(--text-muted);
      letter-spacing: 2px;
      font-weight: 600;
      text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    }

    .wallet-addr {
      font-family: var(--font-numbers);
      font-size: 15px;
      color: var(--text-white);
      font-weight: 700;
      text-shadow: 0 2px 5px rgba(0,0,0,0.8);
    }

    .signout-btn {
      background: var(--glass-bg);
      border: var(--gold-border);
      color: var(--text-gold);
      border-radius: 20px;
      padding: 7px 16px;
      font-size: 12px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      font-family: var(--font-thai);
      backdrop-filter: blur(12px);
      box-shadow: var(--glass-bevel), 0 6px 15px rgba(0,0,0,0.5), 0 0 15px rgba(243, 161, 131, 0.3);
      transition: all 0.25s ease;
    }

    .signout-btn:active {
      transform: scale(0.94);
      box-shadow: inset 2px 2px 6px rgba(0,0,0,0.8);
    }

    /* 2. Main Balances Section */
    .balances-section {
      padding: 14px 20px;
    }

    .main-balance-card {
      background: var(--glass-bg);
      border: var(--glass-border);
      border-radius: 18px;
      padding: 22px 20px;
      position: relative;
      backdrop-filter: blur(16px);
      box-shadow: var(--glass-bevel), 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(243, 161, 131, 0.25);
    }

    .balance-amount {
      font-size: 44px;
      line-height: 1;
    }

    .balance-label {
      font-size: 10px;
      color: var(--text-muted);
      letter-spacing: 1.5px;
      margin-top: 8px;
      font-weight: 600;
      text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    }

    .sdt-floating-box {
      position: absolute;
      top: 18px;
      right: 20px;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
    }

    .sdt-amount {
      font-size: 26px;
      line-height: 1;
      margin-top: 6px;
    }

    .sdt-label {
      font-size: 9px;
      color: var(--text-muted);
      letter-spacing: 0.8px;
      margin-top: 2px;
      font-weight: 600;
    }

    /* โบนัสสะสม — แยกออกจากยอดซื้อชัดเจน ใช้สีทองให้ต่างจากยอดซื้อ */
    .bonus-total-panel {
      margin-top: 22px;
      padding: 14px 16px;
      text-align: center;
      background: linear-gradient(140deg, rgba(60, 40, 10, 0.55) 0%, rgba(20, 12, 4, 0.85) 100%);
      border: 1px solid rgba(243, 161, 131, 0.45);
      border-radius: 14px;
      box-shadow: var(--glass-bevel), 0 4px 12px rgba(0,0,0,0.4), 0 0 18px rgba(243, 161, 131, 0.25);
    }

    .bonus-total-val {
      font-family: var(--font-numbers);
      font-size: 32px;
      font-weight: 700;
      line-height: 1.1;
      margin-bottom: 4px;
    }

    .sub-panels-row {
      display: flex;
      gap: 12px;
      margin-top: 12px;
    }

    .sub-panel {
      flex: 1;
      background: linear-gradient(140deg, rgba(12, 28, 66, 0.7) 0%, rgba(5, 13, 33, 0.85) 100%);
      border: var(--glass-border);
      border-radius: 14px;
      padding: 14px 16px;
      box-shadow: var(--glass-bevel), 0 4px 12px rgba(0,0,0,0.4), 0 0 15px rgba(243, 161, 131, 0.2);
    }

    .sub-panel-title {
      font-size: 9.5px;
      color: var(--text-muted);
      letter-spacing: 0.8px;
      margin-bottom: 6px;
      font-weight: 600;
    }

    .sub-panel-val {
      font-family: var(--font-numbers);
      font-size: 25px;
      font-weight: 700;
      line-height: 1;
    }

    /* 3. Units by Rank Section */
    .ranks-section {
      padding: 10px 20px;
    }

    .ranks-header {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11.5px;
      color: var(--text-muted);
      letter-spacing: 1.2px;
      margin-bottom: 16px;
      font-weight: 600;
      text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    }

    .shields-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .shield-item {
      position: relative;
      width: 60px;
      height: 76px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      filter: drop-shadow(0 6px 10px rgba(0,0,0,0.6));
    }

    .shield-svg {
      position: absolute;
      top: 0; left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
    }

    .shield-content {
      position: relative;
      z-index: 2;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin-top: 2px;
    }

    .shield-rank {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-white);
      text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 8px rgba(255,255,255,0.4);
    }

    .shield-val {
      font-size: 16px;
      margin-top: 1px;
    }

    .v1-rotate-ring {
      position: absolute;
      top: -12px;
      left: -12px;
      width: 84px;
      height: 100px;
      pointer-events: none;
      z-index: 3;
      filter: drop-shadow(0 0 10px rgba(255, 42, 133, 0.85));
      animation: spinRing 6s linear infinite;
    }

    @keyframes spinRing {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    /* 4. Estimated Bonus Section */
    .bonus-section {
      padding: 18px 20px 10px 20px;
    }

    .ribbon-container {
      margin-bottom: 16px;
      display: inline-block;
      filter: drop-shadow(0 0 15px rgba(255, 42, 133, 0.75)) drop-shadow(0 4px 10px rgba(0,0,0,0.6));
    }

    .bonus-ribbon {
      background: linear-gradient(90deg, #FF2A85 0%, #E91E63 55%, rgba(40, 10, 50, 0.9) 100%);
      clip-path: polygon(0 0, 93% 0, 100% 50%, 93% 100%, 0 100%);
      padding: 7px 30px 7px 16px;
      font-size: 11.5px;
      font-weight: 700;
      letter-spacing: 1.2px;
      color: var(--text-white);
      border-left: 3px solid #FFFFFF;
      text-shadow: 0 1px 4px rgba(0,0,0,0.8);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    }

    .bonus-date-bar {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 14px;
      font-family: var(--font-numbers);
      font-size: 13.5px;
      color: var(--text-white);
      margin-bottom: 16px;
      letter-spacing: 1px;
      text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    }

    .refresh-btn {
      background: linear-gradient(135deg, rgba(20, 45, 95, 0.8) 0%, rgba(8, 18, 45, 0.9) 100%);
      border: var(--gold-border);
      border-radius: 8px;
      width: 30px;
      height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: var(--text-white);
      backdrop-filter: blur(8px);
      box-shadow: var(--glass-bevel), 0 4px 10px rgba(0,0,0,0.4), 0 0 12px rgba(243, 161, 131, 0.3);
    }

    .refresh-btn svg {
      transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .total-bonus-card {
      background: var(--glass-bg);
      border: 2px solid #F3A183;
      border-radius: 16px;
      padding: 26px 18px;
      text-align: center;
      backdrop-filter: blur(16px);
      box-shadow: var(--glass-bevel), inset 0 0 25px rgba(243, 161, 131, 0.25), 0 0 25px rgba(243, 161, 131, 0.35), 0 10px 30px rgba(0,0,0,0.5);
      margin-bottom: 14px;
    }

    .total-bonus-val {
      font-size: 42px;
      line-height: 1;
    }

    /* 3D Rose-Gold Metallic Accordion Button */
    .accordion-btn {
      width: 100%;
      background: var(--rose-metallic-btn);
      border: 1px solid #FFE0D8;
      border-radius: 12px;
      padding: 14px 20px;
      display: flex;
      justify-content: center;
      align-items: center;
      color: #3D0D02;
      font-family: var(--font-thai);
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      position: relative;
      box-shadow: 0 6px 20px rgba(184, 82, 51, 0.5), inset 0 2px 3px rgba(255,255,255,0.7), 0 0 15px rgba(243, 161, 131, 0.4);
      transition: all 0.3s ease;
      text-shadow: 0 1px 1px rgba(255,255,255,0.4);
    }

    .accordion-btn:active {
      transform: scale(0.98);
      box-shadow: inset 1px 2px 6px rgba(0,0,0,0.6);
    }

    .accordion-btn .chevron-icon {
      position: absolute;
      right: 20px;
      stroke: #3D0D02;
      transition: transform 0.4s ease;
    }

    .accordion-btn .chevron-icon.rotated {
      transform: rotate(180deg);
    }

    /* 5. Bottom Navigation Bar */
    nav.bottom-nav {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 76px;
      background: linear-gradient(180deg, rgba(6, 15, 38, 0.88) 0%, rgba(2, 6, 18, 0.96) 100%);
      backdrop-filter: blur(20px);

      /* Rose Gold Glowing Top Line */
      border-top: 1.5px solid rgba(243, 161, 131, 0.85);
      display: flex;
      justify-content: space-around;
      align-items: center;
      padding: 0 10px;
      z-index: 10;
      box-shadow: 0 -10px 30px rgba(0,0,0,0.7), inset 0 1px 0 rgba(243, 161, 131, 0.5), 0 -4px 18px rgba(243, 161, 131, 0.35);
    }

    .nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      color: var(--text-muted);
      font-size: 10.5px;
      cursor: pointer;
      background: none;
      border: none;
      font-family: var(--font-thai);
      width: 62px;
      transition: all 0.3s ease;
    }

    .nav-icon-box {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 12px;
      transition: all 0.3s ease;
      border: 1.5px solid transparent;
    }

    /* ACTIVE MENU ITEM - HOT PINK / MAGENTA NEON GLOW */
    .nav-item.active {
      color: #FF2A85;
      font-weight: 600;
    }

    .nav-item.active .nav-icon-box {
      box-shadow: inset 0 0 14px rgba(255, 42, 133, 0.6), 0 0 20px rgba(255, 42, 133, 0.7);
      border: 1.5px solid #FF2A85;
      background: linear-gradient(135deg, rgba(255, 42, 133, 0.2) 0%, rgba(180, 20, 80, 0.12) 100%);
    }

    .nav-item svg {
      stroke: var(--text-muted);
      transition: stroke 0.3s ease, filter 0.3s ease;
    }

    .nav-item.active svg {
      stroke: #FF2A85;
      filter: drop-shadow(0 0 8px rgba(255, 42, 133, 0.95));
    }
  
/* --- Admin & Error Pages Specific Styles --- */
.panel {
    margin-top: 30px;
    background: rgba(8, 18, 45, 0.75);
    border: 1.5px solid rgba(243, 161, 131, 0.75);
    border-radius: 18px;
    padding: 22px 20px;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.35), 0 12px 35px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
}
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(243, 161, 131, 0.2); }
th { color: var(--text-muted); font-size: 14px; letter-spacing: 1px; }
.btn { padding: 8px 16px; background: linear-gradient(180deg, #FAD0C4 0%, #F3A183 40%, #B85233 100%); color: #3D0D02; text-decoration: none; border-radius: 8px; font-weight: 700; border: none; cursor: pointer; }
.error-title { font-family: 'Rajdhani', sans-serif; font-size: 100px; margin: 0; background: linear-gradient(180deg, #FFFFFF 0%, #F3A183 45%, #C26342 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6)); }
.error-title.cyan { background: linear-gradient(180deg, #FFFFFF 0%, #00E5FF 45%, #0088AA 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.error-subtitle { color: #8DA1CB; font-size: 18px; margin-bottom: 30px; }
.error-btn { padding: 12px 24px; background: linear-gradient(180deg, #FAD0C4 0%, #F3A183 40%, #B85233 100%); color: #3D0D02; text-decoration: none; border-radius: 12px; font-weight: 700; box-shadow: 0 6px 20px rgba(184, 82, 51, 0.5); transition: all 0.3s ease; }
.error-btn:active { transform: scale(0.95); }
