:root {
      --black: #050506;
      --black-soft: #11100d;
      --gold: #d8ad57;
      --gold-bright: #ffe2a0;
      --gold-deep: #8b6429;
      --text: #fff8e8;
      --muted: #b9aa8d;
      --line: rgba(216, 173, 87, 0.28);
      --glass: rgba(8, 8, 9, 0.72);
      --felt: #103e2c;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      color: var(--text);
      font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
      background: var(--black);
      overflow-x: hidden;
    }

    .login-loading-screen {
      position: fixed;
      inset: 0;
      z-index: 10000;
      overflow: hidden;
      background: #050506 url("../bg_login_loading.jpg") center center / cover no-repeat;
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transition: opacity 0.32s ease, visibility 0s linear 0.32s;
    }

    .login-loading-screen.is-complete {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }

    .login-loading-bar {
      position: absolute;
      left: 50%;
      bottom: 74px;
      width: 1000px;
      height: 35px;
      transform: translateX(-50%);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.3);
    }

    .login-loading-track {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 980px;
      height: 15px;
      transform: translate(-50%, -50%);
      overflow: hidden;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.5);
    }

    .login-loading-progress {
      box-sizing: border-box;
      width: 0%;
      height: 15px;
      border: 3px solid rgba(255, 255, 255, 0.5);
      border-radius: 999px;
      background: linear-gradient(90deg, #ffc276 0%, #fff8e8 100%);
      transition: width 0.08s linear;
    }

    .login-loading-label {
      position: absolute;
      inset: 0;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 12px;
      line-height: 1;
      font-weight: 700;
      white-space: nowrap;
      -webkit-text-stroke: 1px rgba(0, 0, 0, 0.5);
      paint-order: stroke fill;
      pointer-events: none;
    }

    .login-loading-label span {
      display: inline-block;
      animation: loginLoadingWave 0.78s ease-in-out infinite;
      animation-delay: calc(var(--wave-index) * 0.12s);
    }

    @keyframes loginLoadingWave {
      0%, 100% {
        transform: translateY(0);
      }

      45% {
        transform: translateY(-1.5px);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .login-loading-screen {
        transition: none;
      }

      .login-loading-label span {
        animation: none;
      }
    }

    .scene {
      position: fixed;
      inset: 0;
      z-index: 0;
      background:
        url("../assets/bg_login.jpg") center / cover no-repeat,
        linear-gradient(135deg, #0d0b08 0%, #162117 52%, #070605 100%);
    }

    #casinoCanvas {
      width: 100%;
      height: 100%;
      display: none;
    }

    .language-switcher {
      position: fixed;
      top: clamp(1rem, 2.5vw, 1.8rem);
      right: clamp(1rem, 2.5vw, 2rem);
      z-index: 3;
    }

    .lang-button,
    .lang-option {
      display: inline-flex;
      align-items: center;
      gap: 0.55rem;
      border: 1px solid rgba(216, 173, 87, 0.28);
      border-radius: 8px;
      color: var(--text);
      font: inherit;
      background: rgba(8, 8, 9, 0.58);
      backdrop-filter: blur(14px);
    }

    .lang-button {
      min-width: 7.8rem;
      height: 2.75rem;
      justify-content: space-between;
      padding: 0 0.78rem;
      cursor: pointer;
      box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
    }

    .lang-arrow {
      display: inline-block;
      width: 0.72rem;
      height: 0.72rem;
      border-right: 2.5px solid var(--gold);
      border-bottom: 2.5px solid var(--gold);
      transform: translateY(-2px) rotate(45deg);
      transform-origin: center;
      transition: transform 180ms ease, border-color 180ms ease;
    }

    .lang-button[aria-expanded="true"] .lang-arrow {
      border-color: var(--gold-bright);
      transform: translateY(2px) rotate(225deg);
    }

    .lang-menu {
      position: absolute;
      top: calc(100% + 0.55rem);
      right: 0;
      width: 10.4rem;
      display: grid;
      gap: 0.38rem;
      padding: 0.62rem;
      border: 1px solid rgba(216, 173, 87, 0.28);
      border-radius: 8px;
      background: rgba(8, 8, 9, 0.84);
      box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
      backdrop-filter: blur(18px);
    }

    .lang-menu[hidden] {
      display: none;
    }

    .lang-option {
      width: 100%;
      min-height: 2.55rem;
      padding: 0 0.65rem;
      background: transparent;
      cursor: pointer;
    }

    .lang-option:hover,
    .lang-option.is-active {
      border-color: rgba(255, 226, 160, 0.58);
      background: rgba(216, 173, 87, 0.12);
    }

    .flag {
      position: relative;
      display: inline-block;
      width: 1.45rem;
      height: 1rem;
      flex: 0 0 auto;
      overflow: hidden;
      border-radius: 3px;
      box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 3px 10px rgba(0, 0, 0, 0.25);
    }

    .flag-cn,
    .flag-vn {
      background: #de2910;
    }

    .flag-cn::before,
    .flag-vn::before {
      content: "";
      position: absolute;
      width: 0.43rem;
      height: 0.43rem;
      background: #ffde00;
      clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
    }

    .flag-cn::before {
      left: 0.22rem;
      top: 0.16rem;
    }

    .flag-vn::before {
      left: 50%;
      top: 50%;
      width: 0.58rem;
      height: 0.58rem;
      transform: translate(-50%, -50%);
    }

    .flag-us {
      background: repeating-linear-gradient(to bottom, #b22234 0 7.69%, #fff 7.69% 15.38%);
    }

    .flag-us::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      width: 43%;
      height: 54%;
      background: #3c3b6e;
    }

    .flag-th {
      background: linear-gradient(to bottom, #a51931 0 16.6%, #fff 16.6% 33.2%, #2d2a4a 33.2% 66.8%, #fff 66.8% 83.4%, #a51931 83.4% 100%);
    }

    .page {
      position: relative;
      z-index: 1;
      min-height: 100vh;
      display: grid;
      grid-template-columns: minmax(420px, 500px) 430px;
      justify-content: center;
      align-items: center;
      gap: clamp(4.5rem, 6.25vw, 5.7rem);
      padding: clamp(1.25rem, 4vw, 4rem);
    }

    .brand {
      max-width: 520px;
      padding-left: 2.8rem;
      transform: translateY(-0.6rem);
    }

    .brand-logo {
      width: clamp(150px, 13.5vw, 190px);
      aspect-ratio: 240 / 186;
      height: auto;
      position: relative;
      margin: 0 0 1rem 0;
      overflow: visible;
    }

    .brand-logo svg {
      display: block;
      width: 100%;
      height: auto;
      filter: drop-shadow(0 12px 34px rgba(0, 0, 0, 0.28));
    }

    h1 {
      margin: 0 0 1.35rem;
      max-width: 100%;
      width: max-content;
      font-size: clamp(3.15rem, 4.35vw, 4rem);
      line-height: 1.05;
      letter-spacing: 0;
      white-space: nowrap;
      text-align: left;
      text-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
    }

    .brand p {
      max-width: 27rem;
      margin: 0;
      color: rgba(255, 248, 232, 0.76);
      font-size: clamp(1.05rem, 1.55vw, 1.25rem);
      line-height: 1.8;
    }

    .login-panel {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 8px;
      background:
        linear-gradient(180deg, rgba(255, 226, 160, 0.08), transparent 34%),
        var(--glass);
      box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
      backdrop-filter: blur(18px);
      padding: clamp(1.5rem, 4vw, 2.4rem);
    }

    .panel-top {
      display: flex;
      justify-content: space-between;
      gap: 1rem;
      align-items: flex-start;
      margin-bottom: 2rem;
    }

    .panel-top h2 {
      margin: 0 0 0.45rem;
      font-size: 1.8rem;
      letter-spacing: 0;
    }

    .panel-top p {
      margin: 0;
      color: var(--muted);
      line-height: 1.55;
      font-size: 0.95rem;
    }

    .badge {
      flex: 0 0 auto;
      padding: 0.42rem 0.7rem;
      border: 1px solid rgba(216, 173, 87, 0.35);
      border-radius: 999px;
      color: var(--gold-bright);
      font-size: 0.78rem;
      background: rgba(216, 173, 87, 0.1);
    }

    form {
      display: grid;
      gap: 1rem;
    }

    label {
      display: grid;
      gap: 0.55rem;
      color: rgba(255, 248, 232, 0.86);
      font-size: 0.92rem;
    }

    .field {
      position: relative;
    }

    input[type="text"],
    input[type="password"] {
      width: 100%;
      height: 3.25rem;
      border: 1px solid rgba(216, 173, 87, 0.25);
      border-radius: 8px;
      outline: none;
      padding: 0 3rem 0 1rem;
      color: var(--text);
      font: inherit;
      background: rgba(255, 255, 255, 0.055);
      transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
    }

    input::placeholder {
      color: rgba(185, 170, 141, 0.62);
    }

    input:focus {
      border-color: rgba(255, 226, 160, 0.8);
      box-shadow: 0 0 0 4px rgba(216, 173, 87, 0.14);
      background: rgba(255, 255, 255, 0.08);
    }

    .field.is-invalid input {
      border-color: rgba(227, 61, 82, 0.86);
      box-shadow: 0 0 0 4px rgba(227, 61, 82, 0.14);
    }

    .icon {
      position: absolute;
      right: 0.9rem;
      top: 50%;
      width: 1.2rem;
      height: 1.2rem;
      transform: translateY(-50%);
      color: var(--gold);
      pointer-events: none;
    }

    .password-toggle {
      position: absolute;
      right: 0.65rem;
      top: 50%;
      width: 2rem;
      height: 2rem;
      border: 0;
      padding: 0;
      display: grid;
      place-items: center;
      color: var(--gold);
      background: transparent;
      cursor: pointer;
      transform: translateY(-50%);
    }

    .password-toggle:hover {
      color: var(--gold-bright);
    }

    .row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      margin-top: 0.15rem;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .check {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      white-space: nowrap;
    }

    input[type="checkbox"] {
      width: 1rem;
      height: 1rem;
      accent-color: var(--gold);
    }

    a {
      color: var(--gold-bright);
      text-decoration: none;
    }

    a:hover {
      text-decoration: underline;
    }

    .login-message {
      min-height: 2.25rem;
      display: none;
      align-items: center;
      padding: 0.1rem 0;
      border: 0;
      border-radius: 0;
      color: var(--muted);
      background: transparent;
      font-size: 0.88rem;
      line-height: 1.45;
    }

    .login-message.is-visible {
      display: flex;
    }

    .login-message.is-error {
      color: #ff4b5f;
      border-color: transparent;
      background: transparent;
    }

    .login-message.is-success {
      color: #d9ffe9;
      border-color: transparent;
      background: transparent;
    }

    .submit {
      height: 3.35rem;
      margin-top: 0.5rem;
      border: 0;
      border-radius: 8px;
      color: #171108;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
      background: linear-gradient(135deg, #8b6429 0%, #f5d58c 42%, #b88332 100%);
      box-shadow: 0 14px 34px rgba(216, 173, 87, 0.25);
      transition: transform 160ms ease, filter 160ms ease;
    }

    .submit:hover {
      transform: translateY(-1px);
      filter: brightness(1.06);
    }

    @media (max-width: 860px) {
      .page {
        grid-template-columns: 1fr;
        align-content: center;
        gap: 2rem;
      }

      .brand {
        text-align: center;
        padding-left: 0;
      }

      .brand-logo {
        margin-inline: auto;
      }

      h1 {
        max-width: none;
        font-size: clamp(2.55rem, 12vw, 4.2rem);
      }
    }

    @media (max-width: 520px) {
      .page {
        padding: 1rem;
      }

      .panel-top {
        display: grid;
      }

      .row {
        display: grid;
        gap: 0.7rem;
      }

    }
