  /* Frontend demo only: every number on this page is sample data, nothing is saved or charged. */
  :root {
    --bg: #2b2f33;
    --side: #212529;
    --card: #212529;
    --card-2: #2c3136;
    --line: #3a4046;
    --text: #e9ecef;
    --muted: #adb5bd;
    --blue: #0d6efd;
    --gold: #d9a866;
    --green: #5be35b;
    --purple: #c77dff;
    --red: #ff6b6b;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: "Kanit", "Tahoma", sans-serif;
    line-height: 1.55;
  }
  a { color: inherit; }
  button { font: inherit; }

  /* layout */
  .app { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
  .side {
    position: sticky; top: 0; height: 100vh;
    background: var(--side);
    padding: 20px 16px;
    border-right: 1px solid #191c1f;
  }
  .brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; border-bottom: 1px solid var(--line); }
  .brand img { width: 36px; height: 36px; border-radius: 50%; background: #111; }
  .brand b { font-size: 21px; font-weight: 500; white-space: nowrap; }
  .menu { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 6px; }
  .menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; border-radius: 8px;
    text-decoration: none; color: var(--text); font-size: 17px;
  }
  .menu a:hover { background: #2c3136; }
  .menu a.active { background: var(--blue); }
  .menu svg { width: 20px; height: 20px; flex: none; fill: currentColor; }
  .side .user {
    position: absolute; left: 16px; right: 16px; bottom: 20px;
    padding: 12px; border-radius: 10px; background: #2c3136;
    display: flex; align-items: center; gap: 10px; font-size: 14px;
  }
  .side .user .dot { width: 34px; height: 34px; border-radius: 50%; background: #3a4046; display: grid; place-items: center; }
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 8px; border: 0; cursor: pointer;
    background: var(--blue); color: #fff; text-decoration: none; font-weight: 500;
  }
  .btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
  .btn.small { padding: 6px 12px; font-size: 14px; }
  .btn:disabled { opacity: .5; cursor: not-allowed; }

  main { padding: 0 0 48px; min-width: 0; }
  .topbar {
    display: none;
    align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--side); border-bottom: 1px solid #191c1f;
  }
  .topbar .brand { border: 0; padding: 0; }
  .topbar .brand b { font-size: 18px; }
  .demo-bar {
    background: rgba(217, 168, 102, .14); color: var(--gold);
    border-bottom: 1px solid rgba(217, 168, 102, .35);
    padding: 8px 24px; font-size: 14px; text-align: center;
  }
  .page { display: none; padding: 28px 28px 0; max-width: 1660px; }
  .page.show { display: block; }
  h1 { margin: 0 0 6px; font-size: 30px; font-weight: 600; }
  .sub { margin: 0 0 24px; color: var(--muted); }

  /* home */
  .hero {
    position: relative; overflow: hidden;
    border-radius: 14px; padding: 36px 32px;
    background:
      linear-gradient(110deg, rgba(13,17,20,.92) 35%, rgba(13,17,20,.55)),
      radial-gradient(600px 300px at 85% 30%, rgba(217,168,102,.35), transparent 70%),
      #15191c;
    border: 1px solid var(--line);
  }
  .hero .tag { color: var(--gold); letter-spacing: .08em; font-size: 14px; }
  .hero h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 800; margin: 6px 0 8px; }
  .hero p { color: var(--muted); max-width: 560px; margin: 0 0 20px; }
  .hero .actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .ip {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 8px 8px 14px; border-radius: 8px; background: #0f1214; border: 1px solid var(--line);
    font-family: Consolas, monospace;
  }
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
  .stat small { color: var(--muted); }
  .stat b { display: block; font-size: 26px; font-weight: 600; }
  .stat b .on { color: var(--green); }
  .grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; }
  .panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
  .panel h2 { margin: 0 0 12px; font-size: 19px; font-weight: 600; }
  .feat { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .feat div { background: var(--card-2); border-radius: 10px; padding: 12px 14px; }
  .feat b { color: var(--gold); font-weight: 500; }
  .feat p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
  .news { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
  .news li { border-left: 3px solid var(--blue); padding: 2px 0 2px 12px; }
  .news small { color: var(--muted); display: block; }

  /* shop */
  .tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
  .tabs button {
    padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line);
    background: transparent; color: var(--text); cursor: pointer;
  }
  .tabs button.on { background: var(--blue); border-color: var(--blue); }
  .cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }
  .rank { background: var(--card); border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; container-type: inline-size; }
  .rank .art {
    position: relative; aspect-ratio: 4 / 3;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    background:
      radial-gradient(75% 85% at 50% 45%, color-mix(in srgb, currentColor 22%, transparent), transparent 72%),
      repeating-linear-gradient(135deg, rgba(255, 255, 255, .028) 0 2px, transparent 2px 16px),
      #0b0d10;
    border-bottom: 2px solid color-mix(in srgb, currentColor 55%, transparent);
    font-weight: 800; font-style: italic; font-size: min(64px, 13cqi); letter-spacing: -.02em; line-height: 1;
    text-shadow: 0 0 28px color-mix(in srgb, currentColor 45%, transparent);
  }
  .rank .art .pips { font-size: 15px; font-style: normal; letter-spacing: .3em; padding-left: .3em; text-shadow: none; opacity: .9; }
  .rank .art > span { font-size: 13px; font-style: normal; font-weight: 600; letter-spacing: .32em; padding-left: .32em; color: var(--muted); text-shadow: none; }
  .art-badge {
    position: absolute; top: 12px; right: 12px; padding: 3px 12px; border-radius: 999px;
    background: currentColor; font-size: 13px; font-style: normal; letter-spacing: 0; text-shadow: none;
  }
  .art-badge { color: #111; background: var(--gold); }
  .rank .body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
  .rank h3 { margin: 0 0 8px; font-size: 21px; font-weight: 600; }
  .rank ul { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 9px; }
  .rank .body .btn { margin-top: auto; }
  .group { margin: 8px 0 14px; font-size: 20px; font-weight: 600; }
  .cards + .group { margin-top: 32px; }
  .rank.day .art { aspect-ratio: 16 / 7; font-size: min(46px, 11cqi); flex-direction: column; gap: 4px; display: flex; align-items: center; justify-content: center; }
  .rank.day .art.vault-art {
    flex-direction: row; gap: 7%; border-right: 0;
    background: radial-gradient(70% 90% at 30% 55%, color-mix(in srgb, currentColor 26%, transparent), transparent 70%), #0b0d10;
  }
  .rank.day .art.vault-art img { height: min(110px, 28cqi); width: auto; filter: drop-shadow(0 8px 16px rgba(0,0,0,.55)); }
  .vault-art .cap { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
  .vault-art .cap b { font-size: min(38px, 9.5cqi); font-weight: 800; font-style: italic; letter-spacing: -.02em; line-height: 1; padding-right: .1em; }
  .vault-art .cap small { font-size: 13px; font-style: normal; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
  .rank.day .art span { font-size: 15px; font-style: normal; letter-spacing: .3em; color: var(--muted); font-weight: 600; }
  .item .art { font-style: normal; font-size: 44px; border-right: 0; aspect-ratio: 16 / 9; }

  /* gacha */
  .gacha-box { padding: 22px; }
  .reel { position: relative; height: 168px; overflow: hidden; border-radius: 10px; background: #0b0d10; border: 1px solid var(--line); }
  .reel::before, .reel::after { content: ""; position: absolute; top: 0; bottom: 0; width: 18%; z-index: 2; pointer-events: none; }
  .reel::before { left: 0; background: linear-gradient(90deg, #0b0d10, transparent); }
  .reel::after { right: 0; background: linear-gradient(270deg, #0b0d10, transparent); }
  .strip { position: absolute; top: 14px; left: 0; display: flex; gap: 10px; will-change: transform; }
  .marker { position: absolute; z-index: 3; left: 50%; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); background: var(--gold); box-shadow: 0 0 12px var(--gold); }
  .marker::before, .marker::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border: 9px solid transparent; }
  .marker::before { top: 0; border-top-color: var(--gold); }
  .marker::after { bottom: 0; border-bottom-color: var(--gold); }
  .tile {
    --r: #adb5bd;
    flex: none; width: 130px; height: 138px; border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--r) 16%, #15181b), #15181b 70%);
    border: 1px solid color-mix(in srgb, var(--r) 45%, transparent);
    border-bottom: 4px solid var(--r);
    text-align: center; font-size: 14px; line-height: 1.25;
  }
  .tile .ico { font-size: 44px; line-height: 1; }
  .gacha-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
  .btn.spin { flex-direction: column; gap: 0; min-width: 220px; padding: 10px 22px; font-size: 18px; font-weight: 600; }
  .btn.spin small { font-size: 13px; font-weight: 400; opacity: .85; }
  .btn.ghost-gold { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
  .btn.spin:disabled { opacity: .5; cursor: wait; }
  .gacha-result { margin-top: 18px; padding: 16px; border-radius: 10px; background: #15181b; border: 1px solid var(--line); text-align: center; }
  .gacha-result h3 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
  .gacha-result .won { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
  .gacha-result .tile { width: 118px; height: 124px; }
  .gacha-result .won.ten { display: grid; grid-template-columns: repeat(5, 118px); justify-content: center; }
  @media (max-width: 700px) { .gacha-result .won.ten { grid-template-columns: repeat(2, 118px); } }
  .gacha-result .tile.big { width: 170px; height: 170px; font-size: 16px; box-shadow: 0 0 30px color-mix(in srgb, var(--r) 45%, transparent); }
  .gacha-result .tile.big .ico { font-size: 64px; }
  .group-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-top: 30px; }
  .group-row .group { margin: 0 0 14px; }
  .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
  .legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--r); }
  .prize-grid { --cols: 4; --gap: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
  .prize-grid > .tile { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
  .prize-grid .tile { width: auto; height: auto; padding: 18px 10px 14px; }
  .prize-grid .tile b { font-weight: 500; }
  .prize-grid .tile small { color: var(--r); font-weight: 600; }
  @media (max-width: 700px) { .prize-grid { --cols: 2; } }
  @media (max-width: 560px) {
    .prize-grid { --cols: 2; --gap: 10px; }
    .prize-grid .tile { padding: 14px 6px 10px; font-size: 13px; }
    .prize-grid .tile .ico { font-size: 36px; }
    .btn.spin { min-width: 0; flex: 1; }
    .tile { width: 110px; height: 124px; }
    .reel { height: 152px; }
  }
  /* rules */
  .rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: rule; }
  .rule-list li {
    counter-increment: rule; display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: start;
    padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px;
  }
  .rule-list li::before {
    content: counter(rule); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 10px;
    background: rgba(217, 168, 102, .14); color: var(--gold); font-size: 24px; font-weight: 800;
  }
  .rule-list h2 { margin: 2px 0 4px; font-size: 20px; font-weight: 600; }
  .rule-list p { margin: 0; color: var(--muted); }
  .penalty { margin-top: 18px; padding: 16px 20px; border-radius: 10px; border: 1px solid rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .08); }
  .penalty strong { color: var(--red); }
  .rules-discord { margin-top: 18px; }
  /* topup / coupon */
  .split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
  .amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 16px; }
  .amounts button {
    padding: 14px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2);
    color: var(--text); cursor: pointer;
  }
  .amounts button b { display: block; font-size: 20px; }
  .amounts button small { color: var(--gold); }
  .amounts button.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
  .methods { display: grid; gap: 10px; margin-bottom: 16px; }
  .methods label {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
    background: var(--card-2); border: 1px solid var(--line); cursor: pointer;
  }
  .methods input { accent-color: var(--blue); }
  .note {
    padding: 12px 14px; border-radius: 10px; font-size: 14px;
    background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .35); color: #ffc9c9;
  }
  .field { display: grid; gap: 6px; margin-bottom: 14px; }
  .custom-baht { margin: 12px 0 18px; }
  .custom-baht span { color: var(--muted); font-size: 14px; }
  .custom-baht input { letter-spacing: normal; text-transform: none; }
  .field input {
    padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #15181b;
    color: var(--text); font: inherit; letter-spacing: .06em; text-transform: uppercase;
  }
  .field input:focus { outline: 2px solid var(--blue); outline-offset: 0; }
  .summary div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .summary div:last-child { border: 0; font-size: 19px; }
  .summary span { color: var(--muted); }
  .summary .pay-box { display: block; border: 0; font-size: 15px; margin-top: 14px; text-align: center; }
  .summary .pay-box[hidden] { display: none; }
  .pay-box .qr { background: #fff; border-radius: 8px; padding: 10px; width: min(240px, 100%); margin: 0 auto 10px; }
  .pay-box .qr svg { display: block; width: 100%; height: auto; }
  .pay-box .amount { font-size: 26px; font-weight: 700; color: var(--gold); }
  .pay-box p { margin: 6px 0; color: var(--muted); }
  .user .pts { display: block; color: var(--gold); font-size: 12px; }

  /* items (in-game money) */
  .item-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .item-filters { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 360px; max-width: 620px; }
  .item-filters input, .item-filters select {
    padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
    background: #15181b; color: var(--text); font: inherit; min-width: 0;
  }
  .item-filters input { flex: 1 1 220px; }
  .item-filters select { flex: 0 1 220px; cursor: pointer; }
  .item-filters select[hidden] { display: none; }
  .item-filters input:focus, .item-filters select:focus { outline: 2px solid var(--blue); outline-offset: 0; }
  .wallet { color: var(--muted); }
  .wallet b { color: var(--green); font-weight: 600; }
  .wallet .on { color: var(--green); }
  .wallet .off { color: var(--red); }
  #itemTabs button small { color: var(--muted); font-size: 12px; margin-left: 2px; }
  #itemTabs button.on small { color: #dbe4ff; }
  /* 7 per row on a desktop (owner's choice 2026-10-25), fewer as the screen narrows. */
  .item-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
  @media (max-width: 1399px) { .item-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
  @media (max-width: 1099px) { .item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @media (max-width: 760px) { .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (max-width: 560px) { .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .item img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--card-2); border-radius: 8px; }
  .item h3 {
    margin: 0; font-size: 14px; font-weight: 500; line-height: 1.3; min-height: 2.6em; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere;
  }
  .item-id small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
  .item-id div {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 3px 4px 3px 10px; border-radius: 8px; border: 1px solid var(--line); background: #15181b;
    font-size: 14px; font-variant-numeric: tabular-nums;
  }
  .copy-id {
    display: grid; place-items: center; width: 28px; height: 26px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--muted); cursor: pointer;
  }
  .copy-id:hover { background: var(--card-2); color: var(--text); }
  .copy-id:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; }
  .copy-id svg { width: 16px; height: 16px; fill: currentColor; }
  .item .price { color: var(--gold); font-weight: 600; font-size: 15px; }
  .item .buy { display: flex; gap: 6px; }
  .item .buy input {
    width: 52px; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: #15181b;
    color: var(--text); font: inherit; text-align: center;
  }
  .item .buy .btn { flex: 1; padding: 6px 8px; }
  .item-more { text-align: center; margin: 16px 0 4px; }
  .item-more .btn[hidden] { display: none; }
  .st-done { color: var(--green); }
  .st-failed { color: var(--red); }
  .st-pending, .st-running { color: var(--gold); }
  td small { display: block; color: var(--muted); font-size: 12px; }

  /* ranking */
  table { width: 100%; border-collapse: collapse; }
  th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
  th { color: var(--muted); font-weight: 500; font-size: 14px; }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .medal { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #3a4046; font-size: 14px; }
  tr:nth-child(1) .medal { background: #d4a72c; color: #111; }
  tr:nth-child(2) .medal { background: #b8c0c8; color: #111; }
  tr:nth-child(3) .medal { background: #b06c3b; color: #111; }
  .tagc { font-size: 13px; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
  .t-vip { color: var(--green); border: 1px solid rgba(91,227,91,.4); }
  .t-svip { color: var(--purple); border: 1px solid rgba(199,125,255,.45); }

  .toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
    background: #111; border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px;
    opacity: 0; transition: .25s; pointer-events: none; max-width: calc(100% - 32px);
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  @media (max-width: 980px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .split { grid-template-columns: 1fr; }
  }
  @media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .side {
      position: fixed; z-index: 20; inset: 0 auto 0 0; width: 270px;
      transform: translateX(-100%); transition: transform .2s;
    }
    .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
    .topbar { display: flex; position: sticky; top: 0; z-index: 10; }
    .page { padding: 20px 16px 0; }
    .hero { padding: 26px 20px; }
    .table-wrap { overflow-x: auto; }
  }
  @media (max-width: 560px) {
    .feat { grid-template-columns: 1fr; }
    .amounts { grid-template-columns: repeat(2, 1fr); }
    #page-shop .rank:not(.day) .art { aspect-ratio: 16 / 9; }
  }
