:root {
  --gold: #f5c85d;
  --gold-light: #fff0a4;
  --gold-dark: #8f4b12;
  --wine: #4d0d10;
  --deep: #080302;
  --panel: #1c0a06;
  --cream: #fff0be;
  --red: #9b1429;
  --green: #42d58d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #050201; color: #fff4cd; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell {
  width: 100vw;
  height: 100dvh;
  min-width: 760px;
  min-height: 360px;
  display: grid;
  grid-template-rows: 60px 34px 1fr 59px;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 42%, rgba(124, 24, 18, .34), transparent 38%),
    radial-gradient(circle at 15% 65%, rgba(139, 54, 16, .18), transparent 32%),
    repeating-linear-gradient(117deg, rgba(255,255,255,.012) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, #160604, #050201 76%);
}

.topbar {
  display: grid;
  grid-template-columns: 210px 210px 250px minmax(360px, 1fr) 250px;
  align-items: center;
  gap: 10px;
  padding: 5px 17px;
  border-bottom: 1px solid rgba(222, 153, 50, .55);
  background: linear-gradient(180deg, #0e0905, #050302);
  box-shadow: 0 7px 24px rgba(0,0,0,.82);
  z-index: 5;
}

.brand-lockup { position: relative; padding-left: 26px; text-align: center; line-height: .92; }
.brand-lockup .brand-crown { position: absolute; left: 5px; top: -5px; color: #ffd86d; font-size: 31px; text-shadow: 0 0 11px #ae5a10; }
.brand-lockup b { font-family: Georgia, serif; font-size: 28px; letter-spacing: 1px; color: #f6d06b; text-shadow: 0 2px 2px #000; }
.brand-lockup b span { color: #fff0aa; }
.brand-lockup small { display: block; margin-top: 4px; color: #b89150; font-size: 8px; letter-spacing: 2px; }

.profile-box {
  height: 47px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 13px 3px 4px;
  border: 1px solid #7b4b1e;
  border-radius: 24px;
  color: #ffe7a0;
  background: linear-gradient(180deg, #211008, #080403);
  text-align: left;
}
.profile-avatar { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; color: #2b0e02; font-weight: 1000; background: radial-gradient(circle at 35% 25%, #fff2aa, #c57a24 63%, #552007); border: 2px solid #f1c25c; }
.profile-box b { display: block; max-width: 135px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.profile-box small { display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 8px; color: #fff0b5; background: #6d1518; font-size: 8px; }

.balance-box {
  height: 47px;
  display: grid;
  grid-template-columns: 31px 1fr 43px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #a66926;
  border-radius: 24px;
  background: linear-gradient(180deg, #231107, #090403);
  box-shadow: inset 0 2px 8px #000;
}
.balance-box > i { width: 27px; height: 27px; margin-left: 5px; display: grid; place-items: center; border-radius: 50%; color: #fff0a5; font-style: normal; background: #d69220; box-shadow: inset 0 0 0 4px #f2c45d; }
.balance-box small { display: block; color: #a88959; font-size: 7px; }
.balance-box b { color: #f3d27a; font-size: 17px; }
.balance-box button { height: 45px; border: 0; color: #2a0d02; font-size: 28px; font-weight: 1000; background: linear-gradient(180deg, #fff0a0, #ba6919); }

.top-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.top-actions button { height: 50px; border: 0; color: #c9ab78; background: transparent; }
.top-actions i { display: block; color: #f3cf72; font-style: normal; font-size: 21px; }
.top-actions span { display: block; margin-top: 2px; font-size: 8px; }
.top-actions button:hover { color: #ffe7a0; }
.demo-badge { justify-self: end; padding: 7px 12px; border: 1px solid #754619; border-radius: 10px; color: #e2b85d; font-size: 9px; line-height: 1.5; text-align: center; background: rgba(12,6,3,.7); }

.news-strip { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 0 12px; color: #cbaa72; border-bottom: 1px solid rgba(155, 93, 28, .26); background: rgba(7,3,2,.78); font-size: 10px; }
.news-strip > span { color: #f0c55d; font-size: 19px; }
.news-strip b { color: #f2cb68; }

.lobby { min-height: 0; display: grid; grid-template-columns: 102px 1fr 245px; gap: 11px; padding: 12px 16px 10px; }
.category-rail { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.category { border: 1px solid transparent; border-radius: 10px; color: #997d55; background: rgba(12,6,4,.45); }
.category i { display: block; color: #b18b48; font-style: normal; font-size: 17px; }
.category span { display: block; font-size: 8px; }
.category.active { border-color: #a96b25; color: #f2d58d; background: linear-gradient(180deg, #35150b, #120705); box-shadow: inset 0 0 12px rgba(230,154,52,.13); }

.single-game-stage { min-width: 0; display: grid; place-items: center; }
.hero-game-card {
  width: min(760px, 93%);
  height: min(100%, 420px);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  border: 2px solid #c68832;
  border-radius: 23px;
  background:
    radial-gradient(circle at 32% 50%, rgba(217, 117, 29, .28), transparent 37%),
    linear-gradient(130deg, #1e0805, #57120f 49%, #110604);
  box-shadow: 0 15px 35px #000, inset 0 0 28px rgba(255,200,96,.08);
  cursor: pointer;
}
.hero-game-card::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(255,221,139,.2); border-radius: 16px; pointer-events: none; }
.hero-game-card:active { transform: scale(.992); }
.hot-ribbon { position: absolute; z-index: 5; top: 17px; left: -30px; width: 130px; padding: 5px 0; transform: rotate(-42deg); color: #2b0b02; font-weight: 1000; font-size: 10px; text-align: center; background: linear-gradient(180deg, #ffe886, #c37b21); }
.hero-visual { position: relative; min-width: 0; overflow: hidden; }
.lobby-bowl { position: absolute; width: 82%; left: 6%; bottom: -14%; filter: drop-shadow(0 19px 20px #000); }
.lobby-dice { position: absolute; width: 68%; left: 16%; top: 10%; filter: drop-shadow(0 15px 12px rgba(0,0,0,.85)); }
.hero-copy { z-index: 2; align-self: center; padding: 22px 35px 22px 10px; text-align: center; }
.hero-copy > small { color: #c99b50; font-size: 9px; letter-spacing: 2px; }
.hero-copy h1 { margin: 3px 0 9px; font-family: Georgia, serif; font-size: clamp(44px, 6vw, 78px); line-height: .9; color: #ffe7a0; text-shadow: 0 5px 2px #270902, 0 0 20px rgba(241,182,72,.35); }
.hero-status, .hero-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hero-status span, .hero-totals span { padding: 6px; border-radius: 9px; color: #c8a66e; font-size: 9px; background: rgba(0,0,0,.27); border: 1px solid rgba(162,101,36,.31); }
.hero-status b, .hero-totals b { color: #f5d57f; }
.hero-timer { height: 54px; margin: 7px 0; display: grid; grid-template-columns: 1fr 58px; align-items: center; border: 1px solid #a96726; border-radius: 27px; color: #f0c865; background: linear-gradient(180deg, #32120b, #0b0503); }
.hero-timer span { font-size: 10px; font-weight: 800; }
.hero-timer b { font-size: 26px; }
.play-button { width: 75%; height: 43px; margin-top: 10px; border: 1px solid #ffe79b; border-radius: 22px; color: #310e01; font-weight: 1000; background: linear-gradient(180deg, #fff0a3, #c1741d); box-shadow: 0 0 16px rgba(242,169,54,.27); }

.lobby-feed-panel { min-width: 0; overflow: hidden; display: grid; grid-template-rows: 40px 1fr 38px; border: 1px solid #79491d; border-radius: 14px; background: linear-gradient(180deg, #180906, #080403); box-shadow: inset 0 0 18px #000; }
.lobby-feed-panel header, .lobby-feed-panel footer { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 9px; }
.lobby-feed-panel header b { color: #e3be69; }
.lobby-feed-panel header span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #fff2bd; background: #7c1721; }
.lobby-feed-panel footer { border-top: 1px solid rgba(255,255,255,.06); border-bottom: 0; color: #9c825b; }
.lobby-feed-panel footer b { color: #f0ca70; }
.lobby-feed { overflow: auto; padding: 5px 8px; scrollbar-width: none; }
.feed-row { display: grid; grid-template-columns: 27px 1fr 32px auto; align-items: center; gap: 5px; min-height: 33px; border-bottom: 1px solid rgba(255,255,255,.055); font-size: 8px; }
.feed-avatar { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: #2b0e02; font-weight: 900; background: #d39231; }
.feed-row b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.feed-row strong { color: #e8c472; }
.tai-text { color: #e2b85d; }
.xiu-text { color: #fff3d2; }
.empty-state { padding: 16px 8px; color: #947f60; text-align: center; font-size: 10px; }

.bottom-nav { display: grid; grid-template-columns: minmax(240px, 1.5fr) repeat(5, minmax(105px, 1fr)); border-top: 1px solid #764419; background: linear-gradient(180deg, #180b07, #060302); }
.bottom-nav button { border: 0; border-left: 1px solid rgba(255,255,255,.055); color: #c0a373; background: transparent; font-size: 9px; }
.bottom-nav button i { display: block; color: #dfb75d; font-style: normal; font-size: 19px; }
.bottom-nav button small { display: block; color: #826e51; font-size: 7px; }
.chat-preview { display: flex; align-items: center; padding: 0 14px; color: #927b5c; font-size: 9px; }
.chat-preview b { margin-right: 5px; color: #d49c42; }

.modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.76); backdrop-filter: blur(2px); transition: background .25s; }
.modal-backdrop.soft { background: rgba(0,0,0,.43); }
.dialog { z-index: 1; width: min(410px, 88vw); max-height: 90vh; overflow: auto; position: relative; padding: 22px; border: 2px solid #b9782a; border-radius: 19px; color: #f7e3b2; background: radial-gradient(circle at 50% 0, rgba(233,170,61,.1), transparent 29%), linear-gradient(180deg, #28100a, #090403); box-shadow: 0 0 0 5px #2c160a, 0 24px 70px #000; }
.wide-dialog { width: min(520px, 90vw); }
.dialog h2, .dialog h3 { margin: 0 0 9px; color: #f2ce74; text-align: center; }
.dialog h3 { margin-top: 15px; font-size: 12px; }
.dialog p { color: #bfa77e; font-size: 11px; line-height: 1.45; }
.dialog input, .dialog select { width: 100%; height: 42px; margin: 5px 0; padding: 0 12px; border: 1px solid #825124; border-radius: 10px; outline: none; color: #fff0c2; background: #0e0705; }
.dialog-close { position: absolute; right: 8px; top: 8px; width: 31px; height: 31px; border: 1px solid #b6762b; border-radius: 50%; color: #ffe39d; background: #1e0b07; font-size: 20px; }
.dialog-logo { text-align: center; font-family: Georgia, serif; font-size: 27px; font-weight: 1000; color: #e9bf61; }
.dialog-logo span { color: #fff0a5; }
.gold-button { width: 100%; min-height: 41px; border: 1px solid #ffe59a; border-radius: 11px; color: #2d0d01; font-weight: 1000; background: linear-gradient(180deg, #fff0a0, #c1761e); }
.auth-dialog > p, .auth-dialog > small { display: block; text-align: center; }
.auth-tabs, .history-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin: 11px 0 5px; }
.history-tabs { grid-template-columns: repeat(3, 1fr); }
.auth-tabs button, .history-tabs button { height: 35px; border: 1px solid #74451e; color: #a99269; background: #120705; }
.auth-tabs button.active, .history-tabs button.active { color: #2b0d01; font-weight: 900; background: linear-gradient(180deg, #ffe798, #b86c19); }
.quick-values { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 6px 0 11px; }
.quick-values button { height: 33px; border: 1px solid #825024; border-radius: 8px; color: #e7c981; background: #1c0c08; }
.danger-note { padding: 8px; border: 1px solid #9d3d3d; border-radius: 8px; color: #ffb4aa !important; background: rgba(115,13,28,.15); }
.fee-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 11px; }
.fee-preview span { padding: 8px; border: 1px solid #75461f; border-radius: 8px; color: #a99069; background: rgba(0,0,0,.23); font-size: 10px; }
.fee-preview b { display: block; margin-top: 3px; color: #f1cf78; font-size: 14px; }
.request-list { max-height: 180px; overflow: auto; border: 1px solid rgba(133,79,29,.3); border-radius: 9px; }
.request-row, .history-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 10px; }
.request-row:last-child, .history-row:last-child { border-bottom: 0; }
.request-row small, .history-row small { display: block; color: #8c785a; font-size: 8px; }
.status-badge { display: inline-block; padding: 3px 7px; border-radius: 8px; font-size: 8px; }
.status-badge.pending { color: #2b1400; background: #e7b743; }
.status-badge.approved { color: #032517; background: #54d99b; }
.status-badge.rejected { color: white; background: #a61d38; }
.history-dialog { width: min(690px, 92vw); }
.history-content { max-height: 54vh; overflow: auto; }
.history-row { grid-template-columns: 1.4fr 1fr auto; }
.history-row .positive { color: #5ee0a1; }
.history-row .negative { color: #f07f8d; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 12px 0; }
.stats-grid > div { padding: 11px; border: 1px solid #75471f; border-radius: 10px; text-align: center; background: rgba(0,0,0,.24); }
.stats-grid small { display: block; color: #a48b64; }
.stats-grid b { color: #f2cc70; font-size: 21px; }
.stats-history { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }

.game-window {
  --board-x: 0px;
  --board-y: 0px;
  z-index: 2;
  width: min(810px, 91vw);
  height: min(465px, 91vh);
  min-height: 370px;
  position: fixed;
  left: 50%;
  top: 50%;
  display: grid;
  grid-template-rows: 39px 51px 1fr 35px 59px 23px;
  border: 2px solid #d1983e;
  border-radius: 24px;
  color: #f7e6bd;
  background: radial-gradient(circle at 50% 42%, rgba(157,61,15,.17), transparent 35%), linear-gradient(180deg, #2b120b, #0b0503);
  box-shadow: 0 0 0 5px #3c1d0c, 0 0 0 7px #a86925, 0 24px 70px #000, inset 0 0 25px #000;
  transform: translate(calc(-50% + var(--board-x)), calc(-50% + var(--board-y))) scale(1);
  transform-origin: center;
  transition: transform .27s ease, opacity .27s ease, filter .27s ease;
  touch-action: none;
}
.game-window.zoomed { transform: translate(calc(-50% + var(--board-x)), calc(-50% + var(--board-y))) scale(.64); opacity: .86; filter: saturate(.82); cursor: zoom-in; }
.game-window.moving { transition: none; }
.game-titlebar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 10px; border-bottom: 1px solid rgba(255,218,124,.2); cursor: grab; touch-action: none; }
.game-titlebar:active { cursor: grabbing; }
.game-title { text-align: center; line-height: .9; }
.game-title b { display: block; font-family: Georgia, serif; color: #f7d477; font-size: 20px; }
.game-title small { color: #9f8053; font-size: 7px; letter-spacing: 1.5px; }
.game-title-actions { display: flex; gap: 5px; }
.game-title-actions:last-child { justify-content: flex-end; }
.game-title-actions button { width: 29px; height: 29px; border: 1px solid #ae722b; border-radius: 50%; color: #f6dda0; background: #1b0b07; font-weight: 900; }
.phase-meta { display: grid; grid-template-rows: 28px 22px; padding: 0 12px; }
.phase-tabs { justify-self: center; width: 390px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid #a66925; border-radius: 15px; background: #0f0705; }
.phase-tab { display: flex; align-items: center; justify-content: center; gap: 8px; color: #8f7857; font-size: 9px; }
.phase-tab.active { color: #fff0bd; font-weight: 900; background: linear-gradient(180deg, #8a2c18, #4a0d0d); }
.game-meta { display: flex; justify-content: center; gap: 19px; align-items: center; color: #aa9167; font-size: 8px; }
.game-meta b { color: #f1cf79; }
.connection-state i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: #4bd28e; box-shadow: 0 0 6px #4bd28e; }
.connection-state.offline i { background: #e75062; box-shadow: 0 0 6px #e75062; }

.game-content-grid { min-height: 0; display: grid; grid-template-columns: 145px minmax(300px, 1fr) 145px; gap: 8px; padding: 5px 20px 3px; }
.bet-side { min-width: 0; display: grid; place-items: center; align-content: center; border: 2px solid #a96e2d; border-radius: 17px; box-shadow: inset 0 0 18px #000; }
.tai-side { background: radial-gradient(circle at 50% 33%, rgba(224,165,60,.16), transparent 32%), linear-gradient(180deg, #27140b, #090504); }
.xiu-side { color: #2a1308; background: radial-gradient(circle at 50% 30%, white, #d8c59d 55%, #8c704b 100%); box-shadow: inset 0 0 16px rgba(83,48,17,.55); }
.bet-side.selected { border-color: #ffe79c; box-shadow: 0 0 15px rgba(242,174,56,.55), inset 0 0 18px #000; }
.xiu-side.selected { box-shadow: 0 0 15px rgba(255,244,207,.65), inset 0 0 16px rgba(83,48,17,.55); }
.side-label { font-family: Georgia, serif; font-size: 36px; font-weight: 1000; line-height: .9; }
.tai-side .side-label { color: #111; text-shadow: 0 1px #b88c4c; }
.xiu-side .side-label { color: #fff; text-shadow: 0 2px 2px #2c160c; }
.side-range { margin: 4px; color: #d0a950; font-size: 9px; }
.xiu-side .side-range { color: #65451f; }
.side-coin { width: 86%; padding: 5px; border-radius: 9px; text-align: center; background: rgba(0,0,0,.43); font-size: 12px; }
.side-coin span { color: #e0a92c; }
.side-coin b { color: #f3d27e; }
.xiu-side .side-coin b { color: #fff1c8; }
.side-players { margin: 5px; font-size: 9px; }
.select-side { width: 78%; height: 30px; border: 1px solid #ffe59b; border-radius: 15px; color: #2d0d01; font-size: 9px; font-weight: 1000; background: linear-gradient(180deg, #fff0a3, #bd6c18); }
.select-side:disabled, .place-bet:disabled { opacity: .45; filter: grayscale(1); }

.bowl-zone { min-width: 0; position: relative; display: grid; place-items: center; align-content: center; overflow: visible; }
.main-countdown { position: absolute; z-index: 8; top: 48%; transform: translateY(-50%); color: #fff1b2; font-size: 48px; font-weight: 300; text-shadow: 0 4px 7px #000; pointer-events: none; }
.auto-open { position: absolute; z-index: 9; top: 4px; padding: 3px 9px; border-radius: 8px; color: #d4b773; background: rgba(0,0,0,.5); font-size: 8px; }
.bowl { width: min(300px, 38vw); aspect-ratio: 1.5 / 1; position: relative; display: grid; place-items: center; touch-action: none; }
.bowl-base { position: absolute; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 16px 13px #000); }
.dice-tray { position: absolute; z-index: 2; left: 17%; top: 16%; width: 66%; height: 61%; }
.gold-die { position: absolute; width: 91px; height: 91px; object-fit: contain; filter: drop-shadow(0 8px 6px rgba(0,0,0,.78)); user-select: none; pointer-events: none; }
.gold-die:nth-child(1) { left: 8%; top: 7%; transform: rotate(-7deg); }
.gold-die:nth-child(2) { right: 5%; top: 10%; transform: rotate(7deg); }
.gold-die:nth-child(3) { left: 34%; bottom: -2%; transform: rotate(-2deg); }
.bowl-lid { --lid-x: 0px; --lid-y: 0px; position: absolute; z-index: 5; width: 99%; height: 100%; object-fit: contain; transform: translate(var(--lid-x), var(--lid-y)); filter: drop-shadow(0 15px 12px #000); user-select: none; cursor: grab; touch-action: none; }
.bowl-lid:active { cursor: grabbing; }
.bowl-lid.animate-lid { transition: transform .62s cubic-bezier(.2,.78,.2,1); }
.bowl.dragging .bowl-lid { filter: drop-shadow(0 20px 16px #000) brightness(1.05); }
.result-line { min-height: 17px; color: #d9bd84; font-size: 9px; text-align: center; }
.outcome-line { min-height: 18px; font-size: 10px; font-weight: 900; text-align: center; }
.outcome-line.win { color: #59df9f; }
.outcome-line.lose { color: #e68a91; }

.history-stats-row { display: grid; grid-template-columns: 1fr 210px; gap: 7px; padding: 3px 12px; border-top: 1px solid rgba(255,218,124,.13); border-bottom: 1px solid rgba(255,218,124,.13); }
.history-block, .stat-block { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 8px; border: 1px solid rgba(134,82,27,.31); border-radius: 8px; background: rgba(0,0,0,.2); }
.history-block > span, .stat-block > span { color: #9f855c; font-size: 7px; }
.history-dots { min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; }
.history-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; border: 1px solid #c99843; }
.tai-dot { background: #080706; box-shadow: inset 0 0 0 2px #2c2924; }
.xiu-dot { background: #fff2c7; box-shadow: inset 0 0 0 2px #fff; }
.history-dot.forced { outline: 2px solid #dc334c; }
.stat-block { justify-content: space-between; }
.stat-block b { color: #e7c573; font-size: 9px; }

.bet-controls { display: grid; grid-template-columns: 85px 1fr 108px 90px; align-items: center; gap: 6px; padding: 5px 10px; }
.selected-box, .amount-box { height: 44px; display: grid; place-items: center; align-content: center; border: 1px solid #70431d; border-radius: 9px; background: rgba(0,0,0,.31); }
.selected-box small, .amount-box small { color: #8f7858; font-size: 7px; }
.selected-box b { color: #efca70; font-size: 10px; }
.amount-box input { width: 100%; border: 0; outline: none; color: #f3d37e; text-align: center; background: transparent; font-size: 11px; }
.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.chips button { height: 36px; min-width: 0; padding: 0 2px; border: 2px dashed rgba(255,255,255,.28); border-radius: 50%; color: #2c0d01; font-size: 8px; font-weight: 1000; background: radial-gradient(circle, #ffe99a 0 31%, #cc8427 32% 57%, #5e2109 58%); box-shadow: 0 3px 5px #000; }
.chips button.active { transform: translateY(-3px); box-shadow: 0 0 10px #eaa836; }
.place-bet { height: 44px; border: 1px solid #ffe69c; border-radius: 10px; color: #2c0d01; font-size: 10px; font-weight: 1000; background: linear-gradient(180deg, #fff0a1, #bd6e19); }
.game-footer-line { display: flex; align-items: center; justify-content: space-between; padding: 0 13px; color: #897657; font-size: 7px; }
.game-footer-line b { color: #e9c772; }
.maintenance-banner, .forced-banner { position: absolute; z-index: 20; left: 50%; top: -27px; transform: translateX(-50%); padding: 5px 12px; border-radius: 9px 9px 0 0; white-space: nowrap; font-size: 8px; font-weight: 900; }
.maintenance-banner { color: white; background: #a3132d; }
.forced-banner { color: #2b1000; background: #edbd45; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 15px; transform: translateX(-50%); min-width: 240px; max-width: 80vw; padding: 10px 14px; border-radius: 10px; color: #2b0d01; text-align: center; font-size: 10px; font-weight: 900; background: linear-gradient(180deg, #fff0a3, #c27b21); box-shadow: 0 12px 30px #000; }
.toast.error { color: white; background: linear-gradient(180deg, #d93c52, #771125); }

.rotate-notice { display: none; }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 175px 170px 205px minmax(290px, 1fr) 195px; padding-inline: 10px; }
  .brand-lockup b { font-size: 23px; }
  .lobby { grid-template-columns: 83px 1fr 205px; padding-inline: 9px; }
  .hero-game-card { width: 96%; }
}

@media (max-height: 470px) {
  .app-shell { grid-template-rows: 50px 27px 1fr 50px; }
  .topbar { padding-block: 2px; }
  .profile-box, .balance-box { height: 40px; }
  .balance-box button { height: 38px; }
  .top-actions button { height: 41px; }
  .demo-badge { padding: 4px 8px; }
  .lobby { padding-top: 7px; padding-bottom: 5px; }
  .hero-game-card { height: 100%; }
  .hero-copy h1 { font-size: 45px; }
  .hero-timer { height: 42px; margin: 5px 0; }
  .play-button { height: 35px; margin-top: 6px; }
  .bottom-nav { font-size: 8px; }
  .game-window { width: min(780px, 90vw); height: min(398px, 92vh); min-height: 350px; grid-template-rows: 34px 45px 1fr 31px 51px 20px; }
  .game-content-grid { grid-template-columns: 128px minmax(285px, 1fr) 128px; padding-top: 2px; }
  .bowl { width: min(270px, 37vw); }
  .gold-die { width: 80px; height: 80px; }
  .side-label { font-size: 31px; }
  .select-side { height: 26px; }
  .bet-controls { padding-block: 3px; }
  .chips button { height: 31px; }
  .selected-box, .amount-box, .place-bet { height: 38px; }
}

@media (orientation: portrait) and (max-width: 700px) {
  .rotate-notice { position: fixed; z-index: 500; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle, #461016, #070302 72%); }
  .rotate-card { width: min(330px, 100%); display: grid; gap: 12px; padding: 25px; border: 2px solid #bd7c2c; border-radius: 21px; text-align: center; background: #210b08; }
  .rotate-symbol { color: #f1c65e; font-size: 57px; animation: rotatePhone 1.7s ease-in-out infinite alternate; }
  .rotate-card span { color: #b79e77; font-size: 12px; }
  @keyframes rotatePhone { to { transform: rotate(90deg); } }
}


/* ========================= V6 UI PATCH ========================= */
.game-window { cursor: grab; user-select: none; }
.game-window.moving { cursor: grabbing; }
.game-window button, .game-window input, .game-window select { cursor: pointer; user-select: auto; }
.game-window.zoomed { opacity: .91; filter: saturate(.9) brightness(.93); }
.game-window.zoomed > * { pointer-events: none; }
.game-titlebar { cursor: inherit; }

/* Bàn gọn hơn, bát lớn và xúc xắc nhỏ để ba viên nằm thoáng. */
.game-content-grid { grid-template-columns: 132px minmax(340px, 1fr) 132px; padding-inline: 16px; }
.bowl { width: min(350px, 43vw); aspect-ratio: 668 / 432; }
.bowl-base { width: 100%; height: 100%; }
.dice-tray { left: 19%; top: 18%; width: 62%; height: 57%; }
.gold-die { width: 72px; height: 72px; }
.gold-die:nth-child(1) { left: 7%; top: 5%; transform: rotate(-5deg); }
.gold-die:nth-child(2) { right: 6%; top: 6%; transform: rotate(5deg); }
.gold-die:nth-child(3) { left: 35%; bottom: 0; transform: rotate(0deg); }
.bowl-lid {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: translate3d(var(--lid-x), var(--lid-y), 0);
  transform-origin: center;
  opacity: 1;
  will-change: transform, opacity;
}
.bowl-lid.animate-lid { transition: transform .64s cubic-bezier(.18,.82,.2,1), opacity .24s ease; }
.bowl-lid.lid-gone { opacity: 0 !important; visibility: hidden; transition: opacity .18s ease; }
.bowl.opened .dice-tray { animation: diceRevealV6 .26s ease both; }
@keyframes diceRevealV6 { from { opacity: .82; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.result-line { margin-top: -2px; }

/* Chip cược dạng viên nang. */
.chips { display: flex; align-items: center; gap: 5px; min-width: 0; }
.chips button {
  flex: 1 1 0;
  min-width: 43px;
  height: 32px;
  border: 1px solid #a96422;
  border-radius: 17px;
  color: #2b0d01;
  background: linear-gradient(180deg, #ffeaa0 0 42%, #c27a22 43% 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 3px 6px #000;
}
.chips button.active { transform: translateY(-2px); border-color: #fff0a7; box-shadow: 0 0 11px #eaa836, inset 0 1px 0 rgba(255,255,255,.65); }

/* Chấm cầu đen/trắng rõ nét trên mọi nền. */
.history-dot { width: 13px; height: 13px; border: 2px solid #d6a34b; box-shadow: 0 1px 3px rgba(0,0,0,.7); }
.tai-dot { background: #020202; box-shadow: inset 0 0 0 1px #383838, 0 0 0 1px rgba(255,224,139,.12), 0 1px 3px #000; }
.xiu-dot { background: #fffdf2; box-shadow: inset 0 0 0 1px #fff, 0 0 0 1px rgba(255,224,139,.22), 0 1px 3px #000; }

/* Panel ngoài sảnh: lịch sử phiên thay cho feed trống. */
.history-panel { grid-template-rows: 40px 1fr 38px; }
.lobby-history-wrap { min-height: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding: 10px; }
.history-legend-row { display: flex; justify-content: center; gap: 18px; color: #b39768; font-size: 8px; }
.history-legend-row span { display: flex; align-items: center; gap: 5px; }
.history-legend-row .history-dot { width: 11px; height: 11px; }
.lobby-history-dots { align-content: start; display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; justify-items: center; padding: 8px 5px; border: 1px solid rgba(143,86,30,.25); border-radius: 10px; background: rgba(0,0,0,.2); }
.lobby-history-dots .history-dot { width: 18px; height: 18px; }
.lobby-history-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lobby-history-summary > div { padding: 8px; border: 1px solid rgba(143,86,30,.27); border-radius: 9px; text-align: center; background: rgba(0,0,0,.18); }
.lobby-history-summary small { display: block; color: #907a59; font-size: 7px; }
.lobby-history-summary b { color: #efcb75; font-size: 15px; }

@media (max-height: 470px) {
  .game-content-grid { grid-template-columns: 116px minmax(305px, 1fr) 116px; padding-inline: 12px; }
  .bowl { width: min(310px, 41vw); }
  .gold-die { width: 62px; height: 62px; }
  .chips button { height: 29px; min-width: 38px; font-size: 7px; }
  .lobby-history-dots { gap: 5px; padding: 5px; }
  .lobby-history-dots .history-dot { width: 14px; height: 14px; }
}

/* ===== V7 upgrades ===== */
.history-tabs { grid-template-columns: repeat(4, 1fr); }
.amount-box { grid-template-rows: auto 1fr auto; padding: 2px 4px; }
.amount-box input { height: 20px; }
.amount-preview { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #d8b35e !important; font-size: 6px !important; }
.connection-state.offline { color: #ff9a83; }
.connection-state.offline i { background: #e65055; box-shadow: 0 0 8px #e65055; }
.music-ready { color: #f1cd74; }
@media (max-height: 470px) {
  .amount-preview { display: none; }
  .amount-box { grid-template-rows: auto 1fr; }
}


/* ===== V8: nắp bát khớp phối cảnh, lịch sử rút riêng, kết quả luxury ===== */
.bowl-lid {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  top: 0;
  left: 0;
}
.result-celebration {
  position: absolute;
  z-index: 16;
  left: 50%;
  top: 49%;
  min-width: 250px;
  transform: translate(-50%, -50%);
  padding: 14px 24px 16px;
  border: 1px solid rgba(255, 224, 139, .92);
  border-radius: 18px;
  text-align: center;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 243, 179, .33), transparent 42%),
    linear-gradient(180deg, rgba(63, 25, 9, .96), rgba(13, 5, 3, .96));
  box-shadow: 0 0 0 3px rgba(94, 47, 15, .75), 0 0 28px rgba(245, 183, 63, .52), 0 18px 35px rgba(0, 0, 0, .78);
  animation: luxuryResultIn .32s cubic-bezier(.2,.86,.2,1) both;
}
.result-celebration::before,
.result-celebration::after {
  content: "✦";
  position: absolute;
  top: 50%;
  color: #ffe49a;
  font-size: 19px;
  text-shadow: 0 0 11px #ffbd39;
  animation: luxurySpark 1s ease-in-out infinite alternate;
}
.result-celebration::before { left: 10px; }
.result-celebration::after { right: 10px; animation-delay: .2s; }
.result-celebration small { display: block; color: #d9b96d; font-size: 9px; letter-spacing: 2px; }
.result-celebration strong {
  display: block;
  margin-top: 2px;
  font-family: Georgia, serif;
  font-size: 25px;
  color: #fff2b0;
  text-shadow: 0 2px 0 #6c3409, 0 0 14px #e7a933;
}
.result-celebration.lose { border-color: rgba(213, 112, 94, .9); box-shadow: 0 0 0 3px rgba(77, 20, 16, .75), 0 0 22px rgba(175, 55, 44, .44), 0 18px 35px rgba(0,0,0,.78); }
.result-celebration.lose strong { color: #ffb59e; text-shadow: 0 2px 0 #5e160e, 0 0 12px #b8372c; }
@keyframes luxuryResultIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.72); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes luxurySpark { to { transform: scale(1.25) rotate(20deg); opacity: .65; } }

.withdraw-dialog { width: min(720px, 92vw); }
.withdraw-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 11px 0; }
.withdraw-tabs button { height: 38px; border: 1px solid #74451e; border-radius: 10px; color: #aa9168; background: #120705; }
.withdraw-tabs button.active { color: #2b0d01; font-weight: 1000; background: linear-gradient(180deg, #ffe99c, #ba6e1a); }
.withdraw-panel { min-height: 190px; }
.withdraw-history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 9px; }
.withdraw-history-head small { display: block; color: #8d7757; font-size: 8px; }
.withdraw-history-head button { height: 31px; padding: 0 11px; border: 1px solid #825124; border-radius: 8px; color: #e7c77f; background: #1b0a07; font-size: 8px; }
.withdraw-history-list { max-height: 55vh; overflow: auto; display: grid; gap: 8px; padding-right: 3px; }
.withdraw-history-card { padding: 11px; border: 1px solid rgba(170, 105, 37, .48); border-radius: 12px; background: linear-gradient(180deg, rgba(43, 17, 10, .96), rgba(12, 5, 3, .96)); }
.withdraw-history-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.07); }
.withdraw-history-card header small,
.withdraw-history-grid small { display: block; color: #8d7857; font-size: 7px; }
.withdraw-history-card header b { color: #f0cb72; font-size: 11px; }
.withdraw-history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 8px; }
.withdraw-history-grid > div { min-width: 0; padding: 7px; border-radius: 8px; background: rgba(0,0,0,.22); }
.withdraw-history-grid b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ead4a5; font-size: 9px; }
.withdraw-history-grid .withdraw-amount { color: #ffe28b; font-size: 12px; }
.cancel-withdraw-btn { width: 100%; height: 33px; margin-top: 9px; border: 1px solid #a64b3c; border-radius: 9px; color: #ffb4a4; background: rgba(108, 22, 20, .42); font-size: 8px; font-weight: 900; }
.status-badge.cancelled { color: #e7d6ba; background: #59483b; }
.gh88-disclaimer { margin: 10px 0 0 !important; text-align: center; color: #b79b6d !important; font-size: 8px !important; }

@media (max-height: 470px) {
  .result-celebration { min-width: 220px; padding: 9px 20px 11px; }
  .result-celebration strong { font-size: 21px; }
  .withdraw-history-list { max-height: 46vh; }
  .withdraw-history-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ========================= GIAHAO88 V9 CLOUDFLARE ========================= */
:root {
  --v9-gold: #f3cf79;
  --v9-gold-2: #b96a18;
  --v9-ink: #080302;
  --v9-panel: rgba(24, 8, 5, .94);
}

/* Bàn Tài Xỉu gọn, luxury và cân đối hơn. */
.game-window {
  width: min(780px, 92vw);
  height: min(438px, 91vh);
  min-height: 360px;
  grid-template-rows: 36px 46px 1fr 32px 55px 21px;
  border-color: #e4b95d;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(198, 113, 28, .18), transparent 44%),
    linear-gradient(145deg, rgba(55, 18, 9, .98), rgba(8, 3, 2, .99) 62%);
  box-shadow:
    0 0 0 1px rgba(255, 232, 154, .38),
    0 0 0 6px rgba(49, 20, 8, .94),
    0 24px 80px rgba(0, 0, 0, .92),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.game-titlebar {
  background: linear-gradient(180deg, rgba(87, 35, 12, .98), rgba(22, 7, 4, .98));
  border-bottom-color: rgba(238, 183, 83, .45);
}
.game-content-grid {
  grid-template-columns: 118px minmax(320px, 1fr) 118px;
  gap: 7px;
  padding: 4px 14px 2px;
}
.bet-side {
  border-width: 1px;
  border-color: rgba(217, 156, 61, .78);
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 15%, rgba(231, 169, 72, .12), transparent 45%),
    linear-gradient(180deg, rgba(44, 14, 8, .92), rgba(10, 4, 3, .96));
  box-shadow: inset 0 0 22px rgba(0,0,0,.72), 0 5px 16px rgba(0,0,0,.35);
}
.bet-side.selected {
  border-color: #ffe79b;
  box-shadow: 0 0 18px rgba(245, 185, 70, .45), inset 0 0 20px rgba(0,0,0,.72);
}
.side-label { font-family: Georgia, serif; letter-spacing: 2px; }

/* Vùng cắt thật: toàn bộ khay, xúc xắc và nắp nằm trong một viewport bo elip. */
.bowl-zone { filter: drop-shadow(0 15px 14px rgba(0,0,0,.76)); }
.bowl {
  width: min(335px, 42vw);
  aspect-ratio: 668 / 432;
  overflow: hidden;
  border-radius: 50% / 45%;
  clip-path: inset(0 round 50% 50% 45% 45%);
  isolation: isolate;
  background: radial-gradient(ellipse at center, rgba(110, 52, 13, .22), transparent 67%);
}
.bowl::after {
  content: "";
  position: absolute;
  z-index: 9;
  inset: 1.5%;
  border: 1px solid rgba(255, 226, 139, .16);
  border-radius: 50% / 45%;
  pointer-events: none;
}
.bowl-base {
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-position: center;
  filter: none;
}
.dice-tray {
  z-index: 3;
  left: 19%;
  top: 18%;
  width: 62%;
  height: 57%;
}
.gold-die {
  width: clamp(54px, 8.3vw, 70px);
  height: clamp(54px, 8.3vw, 70px);
}
.bowl-lid {
  --lid-x: 0px;
  --lid-y: 0px;
  z-index: 7;
  left: 50%;
  top: 50%;
  width: 98%;
  height: 98%;
  object-fit: contain;
  object-position: center;
  transform: translate(-50%, -50%) translate3d(var(--lid-x), var(--lid-y), 0) rotate(-1.8deg);
  transform-origin: 50% 54%;
  filter: drop-shadow(0 13px 10px rgba(0,0,0,.82));
}
.bowl-lid.animate-lid {
  transition: transform .64s cubic-bezier(.18,.82,.2,1), opacity .2s ease;
}
.bowl.dragging .bowl-lid {
  filter: drop-shadow(0 18px 13px rgba(0,0,0,.9)) brightness(1.06);
}

/* Lọc lịch sử, xác minh người nhận và thông báo. */
.history-filter-line,
.history-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.history-filter-line h3 { margin: 13px 0 7px; text-align: left; }
.history-filter-line select,
.history-filter-actions select {
  width: auto;
  min-width: 112px;
  height: 32px;
  margin: 0;
  padding: 0 8px;
  font-size: 9px;
}
.history-filter-actions button { flex: 0 0 auto; }
.recipient-check {
  margin: 5px 0 7px;
  padding: 8px 10px;
  border: 1px solid rgba(132, 82, 34, .62);
  border-radius: 9px;
  font-size: 10px;
  background: rgba(0,0,0,.24);
}
.recipient-check.idle { color: #9d8968; }
.recipient-check.verified { color: #80e4ad; border-color: rgba(74, 202, 139, .52); background: rgba(17, 84, 55, .18); }
.recipient-check.invalid { color: #ff9d91; border-color: rgba(225, 78, 68, .55); background: rgba(112, 24, 20, .2); }
.notification-button { position: relative; }
.notification-badge {
  position: absolute;
  right: 7px;
  top: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #bd233b;
  box-shadow: 0 0 9px rgba(255, 67, 95, .7);
  font-size: 8px;
}
.notifications-dialog { width: min(580px, 91vw); }
.notifications-list { max-height: 58vh; overflow: auto; display: grid; gap: 8px; }
.notification-item {
  padding: 10px 12px;
  border: 1px solid rgba(142, 90, 37, .44);
  border-radius: 11px;
  background: rgba(12, 5, 3, .72);
}
.notification-item.unread { border-color: rgba(245, 192, 84, .82); box-shadow: inset 3px 0 0 #dc9d32; }
.notification-item header { display: flex; justify-content: space-between; gap: 10px; }
.notification-item header b { color: #f1ce78; }
.notification-item header small { color: #8c7758; font-size: 8px; }
.notification-item p { margin: 6px 0 0; color: #cbb590; }

@media (max-height: 470px) {
  .game-window { width: min(750px, 93vw); height: min(402px, 93vh); }
  .game-content-grid { grid-template-columns: 108px minmax(290px, 1fr) 108px; padding-inline: 10px; }
  .bowl { width: min(300px, 40vw); }
  .gold-die { width: 58px; height: 58px; }
}
