:root {
  font-family: Inter, ui-sans-serif, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f5f4ed;
  background: #07110d;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 50% 32%, #163a2d 0, #08150f 58%, #050b08 100%); }
button, input { font: inherit; }
button { border: 0; border-radius: 10px; cursor: pointer; background: #e8e7df; color: #12291e; font-weight: 750; transition: transform 120ms, background 120ms, opacity 120ms; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: default; opacity: .42; }
input { width: 100%; border: 1px solid #ffffff20; border-radius: 10px; background: #f7f7f2; color: #112119; padding: 10px; }
main { width: min(1480px, calc(100vw - 32px)); margin: auto; }

.lobby-card { width: min(430px, calc(100vw - 32px)); margin: 10vh auto; padding: 34px; border: 1px solid #ffffff1c; border-radius: 24px; background: #0c2119e8; box-shadow: 0 28px 80px #0009; }
.lobby-card h1 { margin: 8px 0; font-size: 42px; }
.lobby-card p { margin: 0 0 22px; color: #a8b8b0; }
.lobby-card label { display: block; margin: 10px 0; color: #aabbb2; font-size: 12px; }
.lobby-card label input { margin-top: 5px; font-size: 15px; }
.lobby-card small { display: block; margin-top: 16px; color: #7f9489; text-align: center; }
.eyebrow { color: #d9b469; font-size: 11px; letter-spacing: .2em; }
.primary { background: #dcb764; color: #173023; }
#join { width: 100%; padding: 13px; }

#game { height: 100dvh; padding: 10px 0; display: grid; grid-template-rows: 42px minmax(420px, 1fr) auto auto auto; gap: 5px; }
#game[hidden] { display: none; }
.game-header { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.room-meta { display: flex; align-items: baseline; gap: 9px; color: #8da096; font-size: 11px; letter-spacing: .08em; }
.room-meta b { color: #fff; font-size: 21px; letter-spacing: .14em; }
#blinds { padding-left: 10px; border-left: 1px solid #ffffff24; color: #c6d0ca; letter-spacing: 0; }
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-actions button, #settingsPanel summary { padding: 8px 11px; }
.ghost, #settingsPanel summary { background: #ffffff10; color: #e8ece9; }
.connection { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; color: #9db0a6; font-size: 11px; }
.connection::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #d5a24e; }
.connection.online::before { background: #5fc991; box-shadow: 0 0 8px #5fc99180; }
#settingsPanel { position: relative; z-index: 30; }
#settingsPanel summary { list-style: none; border-radius: 10px; cursor: pointer; font-weight: 750; }
#settingsPanel summary::-webkit-details-marker { display: none; }
.settings-menu { position: absolute; top: calc(100% + 7px); right: 0; width: 570px; max-height: calc(100vh - 70px); overflow: auto; padding: 14px; border: 1px solid #ffffff1e; border-radius: 14px; background: #0a1b14fa; box-shadow: 0 20px 60px #000b; }
.settings-menu h3 { margin: 4px 0 10px; color: #d7b46a; font-size: 12px; letter-spacing: .08em; }
.settings { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 14px; }
.settings label { color: #95a79e; font-size: 11px; }
.settings input { margin-top: 4px; padding: 8px; }
.settings button { padding: 9px 11px; white-space: nowrap; }
.admin-player { display: grid; grid-template-columns: minmax(100px, 1fr) 110px 58px 58px; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid #ffffff12; font-size: 12px; }
.admin-player input, .admin-player button { padding: 7px; }
.admin-player .danger { background: #68322f; color: #fff; }

.table-stage { min-height: 0; display: grid; place-items: center; padding: 13px 70px 2px; }
.table { position: relative; width: min(1280px, 100%); height: 100%; min-height: 410px; max-height: 720px; border: clamp(7px, .7vw, 11px) solid #402d20; border-radius: 48% / 45%; background: radial-gradient(ellipse at 50% 43%, #1b6a4d 0, #125039 60%, #0c3828 100%); box-shadow: inset 0 0 0 3px #785238aa, inset 0 0 80px #001c1080, 0 18px 48px #0009; }
.felt-line { position: absolute; inset: 5.5% 4%; border: 1px solid #d9c48c22; border-radius: inherit; pointer-events: none; }
.center-board { position: absolute; z-index: 2; left: 50%; top: 47%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 9px; min-width: 390px; }
.street { color: #9fc5b2; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.pot { display: flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 16px; background: #06140e99; color: #b7c6be; font-size: 12px; white-space: nowrap; }
.pot b { color: #f0c974; font-size: 15px; }
.pot span + span { padding-left: 8px; border-left: 1px solid #ffffff24; }
.board { display: flex; gap: 7px; min-height: 75px; }
.pot-awards { display: grid; gap: 4px; min-height: 0; }
.pot-awards:empty { display: none; }
.pot-awards div { display: grid; grid-template-columns: 54px 62px 15px auto; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid #e8bd6a28; border-radius: 8px; background: #06130ee8; font-size: 10px; }
.pot-awards b { color: #d9b367; }
.pot-awards span { color: #eef1ee; text-align: right; }
.pot-awards i { color: #71877c; font-style: normal; }
.pot-awards strong { color: #f0c36b; }
.playing-card { position: relative; display: inline-flex; width: 52px; height: 74px; padding: 7px 6px; border-radius: 7px; background: linear-gradient(145deg, #fff, #e9e8e1); color: #171b18; box-shadow: 0 4px 10px #0006, inset 0 0 0 1px #00000018; font-style: normal; font-weight: 850; }
.playing-card b { font-size: 18px; line-height: 1; }
.playing-card i { position: absolute; right: 5px; bottom: 5px; font-size: 20px; font-style: normal; }
.playing-card.red { color: #bd3030; }
.card-back { padding: 0; border: 3px solid #e8e4d8; background: repeating-linear-gradient(45deg, #244d70 0 4px, #173952 4px 8px); }
.board-card { display: inline-flex; }
.board-card.card-dealt { animation: dealBoard 240ms ease-out both; animation-delay: var(--deal-delay); }
@keyframes dealBoard { from { opacity: 0; transform: translateY(-14px) rotate(-3deg); } }

.players { position: absolute; inset: 0; z-index: 5; }
.player { position: absolute; left: var(--seat-x); top: var(--seat-y); transform: translate(-50%, -50%); width: clamp(112px, 9vw, 138px); min-height: 76px; padding: 7px 9px; border: 1px solid #ffffff20; border-radius: 12px; background: linear-gradient(180deg, #13251eeF, #07130eef); box-shadow: 0 6px 18px #0008; text-align: center; transition: opacity 180ms, border-color 160ms, box-shadow 160ms; }
.player-name { overflow: hidden; color: #e9eee9; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.host { margin-left: 4px; color: #d9b469; font-size: 8px; }
.stack { margin-top: 2px; color: #f2c873; font-size: 15px; font-weight: 850; }
.bet { color: #8fa399; font-size: 10px; }
.hole { position: absolute; left: 50%; top: calc(100% - 2px); transform: translateX(-50%); display: flex; gap: 3px; min-height: 43px; }
.hole .playing-card { width: 30px; height: 42px; padding: 4px; border-radius: 5px; }
.hole .playing-card b { font-size: 11px; }
.hole .playing-card i { right: 3px; bottom: 2px; font-size: 12px; }
.player.is-me { width: clamp(128px, 10vw, 150px); border-color: #ffffff32; }
.player.is-me .hole .playing-card { width: 42px; height: 59px; padding: 5px; }
.player.is-me .hole .playing-card b { font-size: 15px; }
.player.is-me .hole .playing-card i { font-size: 17px; }
.player.folded { opacity: .36; }
.player.turn { border-color: #efc66d; box-shadow: 0 0 0 2px #d9ae5860, 0 0 20px #e0b65c55, 0 7px 18px #0008; animation: turnIn 300ms ease-out 1; }
@keyframes turnIn { from { transform: translate(-50%, -50%) scale(.96); } }
.player.winner { border-color: #f1c76a; box-shadow: 0 0 0 2px #e8bc5d60, 0 0 28px #e8bc5d88; animation: winnerIn 600ms ease-out 1; }
@keyframes winnerIn { 40% { transform: translate(-50%, -50%) scale(1.06); } }
.seat-badges { position: absolute; top: -10px; left: -8px; display: flex; gap: 2px; }
.seat-badges i { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 3px; border: 2px solid #826536; border-radius: 50%; background: #eee6ce; color: #293a32; font-size: 8px; font-style: normal; font-weight: 900; }
.timer-ring { position: absolute; top: -10px; right: -8px; display: grid; place-items: center; min-width: 25px; height: 25px; border-radius: 50%; background: #d7aa55; color: #12251b; font-size: 10px; font-weight: 900; }
.timer-ring:empty { display: none; }
.player-status { color: #efc66f; font-size: 10px; font-weight: 900; white-space: nowrap; }
.hand-result { position: absolute; left: 50%; top: calc(100% + 47px); transform: translateX(-50%); display: flex; gap: 5px; padding: 4px 7px; border-radius: 8px; background: #050b08e8; font-size: 10px; white-space: nowrap; }
.player.is-me .hand-result { top: calc(100% + 64px); }
.hand-result em { color: #f2c86d; font-style: normal; font-weight: 900; }
.mucked { padding: 6px; border-radius: 6px; background: #ffffff10; color: #82958b; font-size: 10px; white-space: nowrap; }
.emoji-pop { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 8px) scale(.7); opacity: 0; font-size: 30px; pointer-events: none; }
.emoji-pop.show { animation: emojiPop 1.7s ease-out; }
@keyframes emojiPop { 10% { opacity: 1; transform: translate(-50%, -8px) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1.1); } }

.status { min-height: 22px; text-align: center; }
.status p { margin: 0; color: #b9c8c0; font-size: 12px; }
#requests { position: fixed; z-index: 40; left: 50%; bottom: 145px; width: min(520px, calc(100vw - 24px)); transform: translateX(-50%); }
.request { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; padding: 8px 11px; border: 1px solid #ffffff1e; border-radius: 10px; background: #10241beF; font-size: 12px; }
.request button { margin-left: 5px; padding: 6px 10px; }
.turn-banner { height: 0; overflow: hidden; color: #f1c975; text-align: center; font-size: 11px; font-weight: 900; letter-spacing: .18em; transition: height 150ms; }
.turn-banner.visible { height: 18px; }
.turn-banner span { margin-left: 6px; color: #fff; letter-spacing: 0; }

.actions { position: relative; display: flex; align-items: stretch; gap: 7px; width: min(1050px, 100%); min-height: 54px; margin: auto; padding: 7px; border: 1px solid #ffffff13; border-radius: 15px; background: #081711ed; box-shadow: 0 10px 28px #0007; }
.actions > button { min-width: 135px; padding: 11px 18px; font-size: 14px; }
#waitingAction { display: flex; flex: 1; align-items: center; justify-content: center; color: #899c92; font-size: 13px; }
#actionBar.is-turn #waitingAction { display: none; }
#actionBar:not(.is-turn) > [data-act], #actionBar:not(.is-turn) > .raise-toggle, #actionBar:not(.is-turn) > .raise { display: none; }
.fold-action { background: #242d29; color: #d8dfda; }
.call-action { background: #e8e7df; }
.raise-toggle { background: #d9b15e; }
.raise { display: none; flex: 1; grid-template-columns: auto minmax(240px, 1fr) 108px; gap: 7px; }
#actionBar.raise-open .raise { display: grid; }
#actionBar.raise-open .raise-toggle { display: none; }
.raise-presets { display: flex; gap: 4px; }
.raise-presets button { min-width: 44px; padding: 7px; background: #ffffff0e; color: #dcb867; font-size: 11px; white-space: nowrap; }
.raise-control { display: grid; grid-template-columns: 32px minmax(100px, 1fr) 72px 32px; gap: 5px; align-items: center; }
.raise-control button { padding: 7px 3px; }
.raise-control input[type=range] { appearance: none; height: 5px; padding: 0; border: 0; background: #52675d; accent-color: #d7ad58; }
.raise-control input[type=range]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #e1b75e; box-shadow: 0 0 0 4px #e1b75e2c; }
#raiseValue { padding: 8px 4px; text-align: center; font-weight: 850; }
.raise-submit { padding: 6px; background: #d9b15e; white-space: nowrap; }
.raise-submit b { display: block; font-size: 14px; }
.table-extras { display: flex; gap: 5px; margin-left: auto; }
.table-extras > button { padding: 8px 10px; }
.emoji-bar { display: flex; align-items: center; gap: 2px; }
.emoji-bar button { padding: 7px 4px; background: transparent; font-size: 16px; }
#actionBar.busy { pointer-events: none; opacity: .68; }
#actionBar.turn-arrive { animation: actionArrive 400ms ease-out 1; }
@keyframes actionArrive { 40% { box-shadow: 0 0 0 2px #d8ad58, 0 0 24px #d8ad5866; } }

#toast { position: fixed; z-index: 100; left: 50%; bottom: 20px; transform: translate(-50%, 12px); opacity: 0; padding: 10px 17px; border: 1px solid #ffffff20; border-radius: 10px; background: #050a08ee; color: #fff; font-size: 13px; pointer-events: none; transition: opacity 160ms, transform 160ms; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
dialog { width: min(620px, calc(100vw - 28px)); max-height: min(780px, calc(100dvh - 36px)); overflow: auto; border: 1px solid #ffffff22; border-radius: 18px; background: #0b1c15; color: #edf1ee; box-shadow: 0 25px 80px #000c; }
dialog::backdrop { background: #000a; backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 10px; right: 10px; padding: 5px 10px; background: #ffffff10; color: #fff; font-size: 20px; }
.history-id { color: #90a49a; }
.history-board { display: flex; gap: 6px; }
#historyContent b { color: #e9bf68; }
.history-street { margin: 12px 0; padding: 10px 12px; border: 1px solid #ffffff12; border-radius: 11px; background: #ffffff06; }
.history-street h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 7px; color: #a9bbb1; font-size: 12px; }
.history-street h3 span { display: flex; gap: 2px; }
.history-street h3 .playing-card { width: 22px; height: 31px; padding: 2px; }
.history-street h3 .playing-card b { font-size: 8px; }
.history-street h3 .playing-card i { right: 2px; bottom: 1px; font-size: 8px; }
.history-street > div { display: grid; grid-template-columns: minmax(90px, 1fr) 1fr; gap: 12px; padding: 4px 0; font-size: 12px; }
.history-street > div span { color: #d5ddd8; }
.history-pot { display: grid; grid-template-columns: 65px 75px 20px 1fr; gap: 7px; padding: 7px 9px; border-top: 1px solid #ffffff12; font-size: 12px; }
.history-pot i { color: #71877c; font-style: normal; }
.history-pot strong { color: #e9bf68; }

@media (max-width: 1100px) {
  main { width: calc(100vw - 18px); }
  .table-stage { padding-inline: 46px; }
  .player { width: 106px; padding-inline: 6px; }
  .table-extras .emoji-bar { display: none; }
  .raise { grid-template-columns: auto minmax(190px, 1fr) 98px; }
}

@media (max-height: 800px) and (min-width: 769px) {
  #game { grid-template-rows: 38px minmax(390px, 1fr) auto auto auto; padding-block: 6px; }
  .table { min-height: 390px; }
  .player { min-height: 66px; padding-block: 5px; }
  .hole { top: calc(100% - 3px); }
  .player-status { bottom: -51px; }
  .actions { min-height: 50px; }
}

@media (max-width: 768px) {
  main { width: 100%; }
  #game { height: 100dvh; padding: 5px; grid-template-rows: 38px minmax(330px, 1fr) auto auto auto; }
  .game-header { padding: 0; }
  .room-meta > span:first-child, #blinds, #history, #copy { display: none; }
  .room-meta b { font-size: 17px; }
  .header-actions { gap: 3px; }
  .header-actions button, #settingsPanel summary { padding: 7px 6px; font-size: 11px; }
  .connection { font-size: 0; }
  .settings-menu { position: fixed; top: 45px; left: 6px; right: 6px; width: auto; }
  .settings { grid-template-columns: repeat(3, 1fr); }
  .settings button { grid-column: 1 / -1; }
  .admin-player { grid-template-columns: minmax(72px, 1fr) 76px 45px 45px; }
  .table-stage { padding: 30px 23px 28px; }
  .table { width: 100%; min-height: 300px; border-width: 6px; border-radius: 45% / 38%; }
  .center-board { top: 46%; min-width: 230px; gap: 5px; }
  .board { gap: 3px; min-height: 47px; }
  .board .playing-card { width: 33px; height: 47px; padding: 4px; }
  .board .playing-card b { font-size: 12px; }
  .board .playing-card i { right: 3px; bottom: 2px; font-size: 13px; }
  .street { font-size: 8px; }
  .pot { padding: 4px 7px; font-size: 9px; }
  .pot b { font-size: 11px; }
  .pot-awards div { grid-template-columns: 42px 45px 10px auto; gap: 3px; padding: 3px 5px; font-size: 7px; }
  .player { width: 68px; min-height: 48px; padding: 4px 3px; border-radius: 8px; }
  .player.is-me { width: 82px; }
  .player-name { font-size: 9px; }
  .stack { font-size: 10px; }
  .bet { display: none; }
  .hole { gap: 1px; }
  .hole .playing-card, .player.is-me .hole .playing-card { width: 23px; height: 32px; padding: 2px; }
  .hole .playing-card b, .player.is-me .hole .playing-card b { font-size: 8px; }
  .hole .playing-card i, .player.is-me .hole .playing-card i { font-size: 9px; }
  .seat-badges { top: -7px; left: -5px; }
  .seat-badges i { min-width: 16px; height: 16px; border-width: 1px; font-size: 6px; }
  .timer-ring { top: -7px; right: -4px; min-width: 19px; height: 19px; font-size: 8px; }
  .player-status { display: none; }
  .hand-result, .player.is-me .hand-result { top: calc(100% + 35px); padding: 2px 4px; font-size: 7px; }
  .status p { font-size: 10px; }
  .actions { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; padding: 5px; gap: 5px; }
  .actions > button { min-width: 0; padding: 10px 5px; font-size: 12px; }
  #waitingAction { grid-column: 1 / -1; min-height: 38px; }
  .raise { grid-column: 1 / -1; grid-template-columns: 1fr 82px; }
  .raise-presets { grid-column: 1 / -1; }
  .raise-presets button { flex: 1; min-width: 0; padding: 6px 2px; }
  .raise-control { grid-template-columns: 25px minmax(70px, 1fr) 58px 25px; }
  #raiseValue { padding-inline: 2px; }
  .raise-submit { grid-column: 2; grid-row: 2; }
  .table-extras { grid-column: 1 / -1; justify-content: center; }
  .emoji-bar { display: flex !important; }
  .emoji-bar button { font-size: 14px; }
  #requests { bottom: 125px; }
}

@media (max-width: 420px) {
  .table-stage { padding-inline: 12px; }
  .player { width: 60px; }
  .player.is-me { width: 75px; }
  .center-board { transform: translate(-50%, -45%) scale(.92); }
  .table-extras > button { font-size: 10px; }
}
