:root {
  --gold: #d4af37;
  --gold-2: #f3d77a;
  --bg: #07060a;
  --panel: rgba(14, 12, 18, 0.82);
  --panel-border: rgba(212, 175, 55, 0.35);
  --text: #f2ede0;
  --muted: #a69f8e;
  --red: #e84a5a;
  --green: #2ecc71;
  --blue: #3b9cff;
  --radius: 14px;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); user-select: none; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
kbd { font: 600 10px/1 Consolas, monospace; padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,.12); margin-left: 6px; opacity: .75; }

#gl { position: fixed; inset: 0; }
#gl canvas { display: block; width: 100%; height: 100%; }

/* ---------------------------------------------------------------- loading */
#loading {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(ellipse at center, #1b1310 0%, #050404 70%); transition: opacity .8s;
}
#loading.done { opacity: 0; pointer-events: none; }
.load-logo { font-size: 28px; letter-spacing: 12px; color: var(--gold); }
.load-title { font: 700 64px Georgia, serif; letter-spacing: 10px; background: linear-gradient(180deg, #fff3c4, #d4af37 55%, #8a6a1d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.load-bar { width: 320px; height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; }
.load-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transform: scaleX(0); transform-origin: left; transition: transform .2s; }
.load-text { color: var(--muted); font-size: 14px; letter-spacing: 1px; }

/* ---------------------------------------------------------------- screens */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.screen.dim { background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.menu-main { display: flex; flex-direction: column; align-items: center; gap: 34px; }
.logo { text-align: center; }
.logo .suits { color: var(--gold); letter-spacing: 14px; font-size: 22px; text-shadow: 0 0 20px rgba(212,175,55,.6); }
.logo h1 {
  margin: 4px 0 0; font: 700 clamp(56px, 9vw, 110px)/1 Georgia, serif; letter-spacing: .12em;
  background: linear-gradient(180deg, #fff6d0 0%, #f3d77a 35%, #d4af37 60%, #7d5e17 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.8));
}
.logo-sub { font: italic 20px Georgia, serif; color: var(--text); opacity: .8; letter-spacing: 6px; text-transform: uppercase; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: min(360px, 90vw); }
.menu-foot { display: flex; gap: 10px; }

.btn {
  position: relative; padding: 13px 22px; border-radius: 12px; cursor: pointer; border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(40,34,28,.92), rgba(18,15,12,.92)); font-weight: 600; letter-spacing: .5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.07); transition: transform .12s, border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.btn small { font-weight: 400; font-size: 12px; opacity: .7; margin-top: 2px; }
.btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 10px 26px rgba(0,0,0,.55), 0 0 18px rgba(212,175,55,.25); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #e9c869, #b8902c); color: #1d1404; border-color: #f3d77a; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.big { padding: 16px 30px; font-size: 18px; }
.chip-btn { padding: 7px 14px; border-radius: 30px; border: 1px solid var(--panel-border); background: var(--panel); cursor: pointer; font-size: 13px; }
.chip-btn:hover { border-color: var(--gold); }

.panel {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px; padding: 26px 28px; width: min(520px, 100%);
  backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow: auto;
}
.panel.wide { width: min(1080px, 100%); }
.panel.small-panel { width: min(340px, 100%); }
.panel h2 { margin: 0 0 6px; font: 700 28px Georgia, serif; color: var(--gold-2); }
.panel h3 { margin: 4px 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.panel label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.panel label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
.panel output { color: var(--gold-2); }
.panel input[type=number], .panel select, .pname {
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 8px 10px; color: var(--text);
}
.panel select option { background: #1a1612; }
input[type=range] { accent-color: var(--gold); }
input[type=checkbox] { accent-color: var(--gold); width: 18px; height: 18px; }
.panel-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.cols { display: flex; gap: 28px; flex-wrap: wrap; }
.col { flex: 3; min-width: 300px; }
.col.narrow { flex: 1.2; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.plist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.prow { display: grid; grid-template-columns: 40px 1.3fr .9fr .9fr 1.3fr 36px 32px; gap: 6px; align-items: center; }
.prow select, .prow input { padding: 7px 6px; font-size: 13px; min-width: 0; }
.prow input[type=color] { width: 36px; height: 34px; padding: 2px; border: none; background: none; cursor: pointer; }
.avatar-btn { width: 40px; height: 36px; border-radius: 10px; font-size: 20px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.35); cursor: pointer; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.35); cursor: pointer; }
.icon-btn:disabled { opacity: .3; }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud input, #action-panel, #history { pointer-events: auto; }
.topbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: flex-start; gap: 12px; }
.tb-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tb-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--panel-border); background: var(--panel); cursor: pointer; font-size: 18px; backdrop-filter: blur(8px); }
.tb-btn:hover { border-color: var(--gold); }
#info { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 7px 14px; backdrop-filter: blur(8px); }
.info-mode { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); }
.info-main { font-weight: 600; font-size: 14px; }
.info-sub { font-size: 12px; color: var(--muted); }
#fps { font: 600 12px Consolas, monospace; color: var(--green); background: var(--panel); padding: 4px 8px; border-radius: 6px; }

#history { position: absolute; top: 66px; right: 12px; width: 320px; max-height: 50vh; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; backdrop-filter: blur(10px); }
#history-list { max-height: 50vh; overflow: auto; padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.h-hand { color: var(--gold); margin-top: 6px; font-weight: 600; }
.h-board { color: #8fd3ff; }
.h-win { color: var(--green); font-weight: 600; }
.h-fold { color: var(--muted); }
.h-out { color: var(--red); }

/* Player plates */
#plates, #labels { position: absolute; inset: 0; }
.plate {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; min-width: 150px;
  background: linear-gradient(180deg, rgba(24,20,16,.92), rgba(10,8,7,.92)); border: 1px solid rgba(255,255,255,.1); border-radius: 40px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); transition: border-color .2s, box-shadow .2s, opacity .3s, filter .3s; will-change: transform;
}
.plate-avatar { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 70%, white), var(--pc)); box-shadow: 0 0 0 2px rgba(0,0,0,.6), 0 0 0 3px var(--pc); }
.role { position: absolute; right: -6px; bottom: -4px; font: 700 9px/1 sans-serif; font-style: normal; padding: 3px 4px; border-radius: 6px; opacity: 0; transform: scale(.5); transition: .25s; }
.role.show { opacity: 1; transform: scale(1); }
.r-D { background: #f7f4ec; color: #111; }
.r-SB { background: var(--blue); color: #fff; }
.r-BB { background: var(--red); color: #fff; }
.plate-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.human-tag { color: var(--gold); font-size: 11px; }
.plate-stack { font: 700 15px Georgia, serif; color: var(--gold-2); }
.plate-action, .plate-hand, .plate-equity {
  position: absolute; left: 50%; transform: translateX(-50%) scale(.8); white-space: nowrap; opacity: 0; transition: .25s; pointer-events: none;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}
.plate-action { top: -26px; background: rgba(0,0,0,.8); border: 1px solid rgba(255,255,255,.15); }
.plate-action.show, .plate-hand.show, .plate-equity.show { opacity: 1; transform: translateX(-50%) scale(1); }
.a-fold { color: var(--muted); }
.a-check { color: #9fd8ff; }
.a-call { color: var(--green); }
.a-bet, .a-raise { color: #ffb347; }
.a-allin { color: #fff; background: linear-gradient(90deg, #c2185b, #ff5722) !important; border-color: #ff8a65 !important; }
.plate-hand { bottom: -26px; background: linear-gradient(90deg, #b8902c, #e9c869); color: #1d1404; }
.plate-equity { top: -52px; background: var(--blue); color: #fff; font-size: 13px; }
.plate-timer { position: absolute; left: 18px; right: 18px; bottom: -3px; height: 3px; border-radius: 2px; overflow: hidden; opacity: 0; }
.plate-timer i { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.plate.timing .plate-timer { opacity: 1; }
.plate.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.35), 0 0 28px rgba(212,175,55,.45); }
.plate.folded { opacity: .55; }
.plate.out { opacity: .35; filter: grayscale(1); }
.plate.winner { border-color: var(--green); box-shadow: 0 0 30px rgba(46,204,113,.6); animation: pulse 1s ease-in-out 3; }
@keyframes pulse { 50% { box-shadow: 0 0 46px rgba(46,204,113,.9); } }

.bet-label, .pot-label { position: absolute; left: 0; top: 0; font: 700 13px Georgia, serif; padding: 2px 9px; border-radius: 12px; background: rgba(0,0,0,.7); color: var(--gold-2); white-space: nowrap; }
.pot-label { font-size: 16px; padding: 4px 14px; border: 1px solid var(--panel-border); }
.pot-label span { font: 600 11px 'Segoe UI', sans-serif; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-right: 4px; }

.banner { position: absolute; top: 26%; left: 50%; transform: translate(-50%, -50%) scale(.7); opacity: 0; font: 700 44px Georgia, serif; letter-spacing: 6px; text-transform: uppercase;
  color: var(--gold-2); text-shadow: 0 4px 24px rgba(0,0,0,.9), 0 0 30px rgba(212,175,55,.5); transition: .35s cubic-bezier(.2,1.4,.4,1); pointer-events: none; white-space: nowrap; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner.b-allin { color: #ff7a45; text-shadow: 0 0 30px rgba(255,90,40,.8); }
.banner.b-level { font-size: 28px; color: #9fd8ff; }

#toasts { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast { padding: 10px 20px; border-radius: 30px; background: var(--panel); border: 1px solid var(--panel-border); font-weight: 600; backdrop-filter: blur(10px);
  animation: toastIn .35s cubic-bezier(.2,1.4,.4,1); transition: opacity .5s, transform .5s; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.out { opacity: 0; transform: translateY(-10px); }
.t-win { border-color: var(--green); color: #b9ffd4; }
.t-allin { border-color: #ff7a45; color: #ffd0bd; }
.t-out { border-color: var(--red); color: #ffc2c8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }

/* Bottom: my cards + actions */
.bottom { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; align-items: flex-end; justify-content: center; gap: 18px; padding: 0 12px; }
.my-hand { position: absolute; left: 16px; bottom: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#mycards { display: flex; gap: 6px; opacity: 0; transform: translateY(20px); transition: .3s; }
#mycards.show { opacity: 1; transform: none; }
.mini-card { width: 74px; border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.6); }
#hand-strength { padding: 6px 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--panel-border); font-weight: 600; font-size: 14px; color: var(--gold-2); opacity: 0; transition: .3s; }
#hand-strength.show { opacity: 1; }

#action-panel { display: none; position: relative; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px; padding: 14px 16px 18px;
  backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.6); gap: 18px; align-items: flex-end; animation: panelIn .3s cubic-bezier(.2,1.3,.4,1); }
#action-panel.show { display: flex; }
@keyframes panelIn { from { opacity: 0; transform: translateY(30px); } }
.ap-left { display: flex; flex-direction: column; gap: 8px; }
.ap-odds { font-size: 13px; color: var(--muted); }
.ap-odds b { color: #9fd8ff; }
.ap-buttons { display: flex; gap: 10px; }
.act { min-width: 120px; padding: 14px 18px; border-radius: 12px; border: none; cursor: pointer; font-weight: 700; font-size: 15px; color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.2); transition: transform .1s, filter .15s; }
.act:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.15); }
.act:disabled { opacity: .35; cursor: default; }
.act.fold { background: linear-gradient(180deg, #6b2b33, #44161c); }
.act.check, .act.call { background: linear-gradient(180deg, #2f7d4c, #1b4f2f); }
.act.raise { background: linear-gradient(180deg, #c48a23, #85590f); }
.act.allin { background: linear-gradient(180deg, #d4413a, #8c1b16); }
.ap-sizing { display: flex; flex-direction: column; gap: 8px; width: 330px; }
.ap-presets { display: flex; gap: 6px; }
.preset { flex: 1; padding: 6px 4px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.35); cursor: pointer; font-size: 12px; }
.preset:hover { border-color: var(--gold); }
.ap-slider-row { display: flex; gap: 8px; align-items: center; }
.ap-slider { flex: 1; }
.ap-input { width: 90px; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 6px 8px; }
.ap-timer { position: absolute; left: 14px; right: 14px; bottom: 7px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.ap-timer i { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.ap-timer.urgent i { background: var(--red); }

/* ---------------------------------------------------------------- modal */
#modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); padding: 16px; }
#modal.opaque { background: radial-gradient(ellipse at center, rgba(20,14,10,.97), rgba(0,0,0,.99)); backdrop-filter: blur(30px); }
.modal-box { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px; padding: 24px 28px; min-width: min(380px, 100%); max-width: 560px; box-shadow: 0 30px 80px rgba(0,0,0,.7); text-align: center; }
#modal.opaque .modal-box { background: transparent; border: none; box-shadow: none; }
.modal-box h3 { margin: 0 0 8px; font: 700 22px Georgia, serif; color: var(--gold-2); }
.modal-box p { color: var(--muted); }
.modal-foot { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.privacy { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.privacy-avatar { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 60px; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 70%, white), var(--pc)); box-shadow: 0 0 0 4px #000, 0 0 0 6px var(--pc), 0 0 60px var(--pc); }
.privacy-label { color: var(--muted); text-transform: uppercase; letter-spacing: 3px; font-size: 13px; margin-top: 10px; }
.privacy h2 { margin: 0; font: 700 44px Georgia, serif; color: var(--gold-2); }
.discard-row { display: flex; gap: 14px; justify-content: center; margin-top: 10px; }
.discard-row img { width: 110px; border-radius: 8px; cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: 0 8px 20px rgba(0,0,0,.6); }
.discard-row img:hover { transform: translateY(-10px) rotate(-3deg); box-shadow: 0 0 0 3px var(--red), 0 14px 30px rgba(0,0,0,.6); }
.next-hand { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 15; }

/* Game over */
.go-list { display: flex; flex-direction: column; gap: 6px; }
.go-row { display: grid; grid-template-columns: 30px 36px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.04); }
.go-row.first { background: linear-gradient(90deg, rgba(212,175,55,.35), rgba(212,175,55,.05)); border: 1px solid var(--panel-border); }
.go-pos { font: 700 18px Georgia, serif; color: var(--gold); }
.go-av { font-size: 22px; }
.go-stack { font: 700 15px Georgia, serif; color: var(--gold-2); }

@media (max-width: 760px) {
  .plate { min-width: 0; padding-right: 10px; transform-origin: center; }
  .plate-avatar { width: 32px; height: 32px; font-size: 16px; }
  .plate-name { font-size: 11px; }
  .plate-stack { font-size: 12px; }
  .bottom { flex-direction: column; align-items: stretch; }
  .my-hand { position: static; }
  #action-panel { flex-direction: column; align-items: stretch; }
  .ap-buttons { flex-wrap: wrap; }
  .act { min-width: 0; flex: 1; }
  .ap-sizing { width: auto; }
  .prow { grid-template-columns: 36px 1fr 1fr; }
}

/* ---------------------------------------------------------------- game modes */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; text-align: left; cursor: pointer;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.35); transition: border-color .15s, transform .12s, background .15s; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--panel-border); }
.mode-card.sel { border-color: var(--gold); background: linear-gradient(180deg, rgba(212,175,55,.22), rgba(212,175,55,.05)); }
.mode-card .mc-icon { font-size: 22px; }
.mode-card b { font-size: 14px; }
.mode-card small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.panel .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel .hint { font-size: 11.5px; color: var(--muted); opacity: .85; }

/* ---------------------------------------------------------------- hand row, skip, history, rankings */
.hand-row { display: flex; gap: 14px; align-items: flex-end; }
#boardcards { display: flex; gap: 5px; padding: 6px; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.08); opacity: 0; transform: translateY(20px); transition: .3s; }
#boardcards.show { opacity: 1; transform: none; }
.mini-card.board { width: 62px; }
.btn.skip { position: absolute; right: 16px; bottom: 0; pointer-events: auto; }
.h-title { font: 700 15px Georgia, serif; color: var(--gold-2); margin-bottom: 2px; }
.h-empty { color: var(--muted); font-style: italic; padding: 6px 0; }
.h-sec { border-left: 2px solid rgba(212,175,55,.35); padding: 2px 0 4px 10px; margin: 6px 0; }
.h-street { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); margin-bottom: 2px; }
.h-cards { font: 700 13px Georgia, serif; letter-spacing: 1px; color: #fff; text-transform: none; margin-left: 6px; }
.h-show { color: #d7e6ff; }
.rank-panel { max-width: 860px; }
.rank-sub { margin: 0; color: var(--muted); font-size: 13px; }
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; align-items: center; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.rank-row:first-child { background: linear-gradient(90deg, rgba(212,175,55,.25), rgba(212,175,55,.04)); border-color: var(--panel-border); }
.rank-n { font: 700 18px Georgia, serif; color: var(--gold); text-align: center; }
.rank-txt b { display: block; font-size: 15px; }
.rank-txt small { color: var(--muted); font-size: 12.5px; }
.rank-cards { display: flex; gap: 4px; }
.rank-cards img { width: 52px; border-radius: 5px; box-shadow: 0 4px 10px rgba(0,0,0,.5); transition: .2s; }
.rank-cards img.on { transform: translateY(-4px); box-shadow: 0 0 0 2px var(--gold), 0 6px 14px rgba(0,0,0,.6); }
.rank-cards img.off { opacity: .4; filter: grayscale(.6); }
.modal-box.bare { background: transparent; border: none; box-shadow: none; padding: 0; max-width: 900px; width: 100%; text-align: left; }
@media (max-width: 760px) {
  .rank-row { grid-template-columns: 24px 1fr; }
  .rank-cards { grid-column: 1 / -1; }
  .rank-cards img { width: 44px; }
  .btn.skip { position: static; }
}

/* people avatars (photos / 3D portraits) */
.plate-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; pointer-events: none; }

/* ---------------------------------------------------------------- luxury menu motion */
.screen.enter { animation: screenIn .45s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes screenIn { from { opacity: 0; transform: scale(.97); filter: blur(10px); } to { opacity: 1; transform: none; filter: blur(0); } }

.logo .suits { display: inline-block; animation: fadeUp 1s .5s both; }
.logo .suits i { font-style: normal; display: inline-block; animation: suitGlow 4s ease-in-out infinite; }
.logo .suits i:nth-child(2) { animation-delay: .5s; } .logo .suits i:nth-child(3) { animation-delay: 1s; } .logo .suits i:nth-child(4) { animation-delay: 1.5s; }
@keyframes suitGlow { 50% { text-shadow: 0 0 30px rgba(243,215,122,.95); transform: translateY(-2px); } }
.logo h1 {
  background-image: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.95) 50%, transparent 62%), linear-gradient(180deg, #fff6d0 0%, #f3d77a 35%, #d4af37 60%, #7d5e17 100%);
  background-size: 250% 100%, 100% 100%; background-repeat: no-repeat; background-position: 160% 0, 0 0;
  animation: logoReveal 1.2s cubic-bezier(.2, .8, .2, 1) both, shimmer 7s 1.4s ease-in-out infinite;
}
@keyframes logoReveal { from { opacity: 0; letter-spacing: .3em; transform: scale(1.06); } to { opacity: 1; letter-spacing: .12em; transform: none; } }
@keyframes shimmer { 0% { background-position: 160% 0, 0 0; } 25%, 100% { background-position: -60% 0, 0 0; } }
.logo-sub { animation: fadeUp .9s .9s both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.menu-buttons .btn { animation: btnIn .6s cubic-bezier(.2, .9, .3, 1.1) backwards; }
.menu-buttons .btn:nth-child(1) { animation-delay: .25s; } .menu-buttons .btn:nth-child(2) { animation-delay: .32s; }
.menu-buttons .btn:nth-child(3) { animation-delay: .39s; } .menu-buttons .btn:nth-child(4) { animation-delay: .46s; }
.menu-buttons .btn:nth-child(5) { animation-delay: .53s; } .menu-buttons .btn:nth-child(6) { animation-delay: .6s; }
@keyframes btnIn { from { opacity: 0; transform: translateX(-28px) scale(.96); } to { opacity: 1; transform: none; } }
.menu-foot { flex-wrap: wrap; justify-content: center; animation: fadeUp .8s 1.5s both; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 28px rgba(243,215,122,.6); filter: brightness(1.06); }
.btn::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: linear-gradient(105deg, transparent 35%, rgba(243,215,122,.18) 50%, transparent 65%); }
.btn:hover:not(:disabled)::after { opacity: 1; }
.chip-btn { transition: transform .12s, border-color .15s, box-shadow .15s; }
.chip-btn:hover { transform: translateY(-1px); box-shadow: 0 0 14px rgba(212,175,55,.3); }

/* ---------------------------------------------------------------- settings */
.settings-panel { width: min(640px, 100%); }
.set-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.06); }
.set-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 6px; border-radius: 10px; border: 1px solid transparent;
  background: none; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; transition: background .2s, color .2s, border-color .2s; min-width: 0; }
.set-tab span { font-size: 18px; } .set-tab em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-tab:hover { color: var(--text); }
.set-tab.sel { color: var(--gold-2); border-color: var(--panel-border); background: linear-gradient(180deg, rgba(212,175,55,.22), rgba(212,175,55,.05)); }
.set-body { display: flex; flex-direction: column; gap: 4px; animation: fadeUp .3s both; min-height: 220px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.set-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.set-info b { font-size: 14.5px; color: var(--text); }
.set-info small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.set-ctl { flex: 0 0 auto; display: flex; align-items: center; }
.set-ctl select { min-width: 150px; }
.slide { display: flex; align-items: center; gap: 10px; width: 210px; }
.slide input { flex: 1; min-width: 0; }
.slide output { min-width: 42px; text-align: right; font: 700 14px Georgia, serif; color: var(--gold-2); }
.set-note { margin: 8px 4px 0; padding: 10px 14px; border-left: 2px solid var(--gold); background: rgba(212,175,55,.07); border-radius: 0 10px 10px 0; font-size: 13px; color: var(--text); }
.panel label.switch { position: relative; display: inline-block; flex-direction: row; width: 46px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .knob { position: absolute; inset: 0; border-radius: 26px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); transition: background .2s, border-color .2s; }
.switch .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #d8d2c2; transition: transform .22s cubic-bezier(.3, 1.4, .5, 1), background .2s; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.switch input:checked + .knob { background: linear-gradient(180deg, #e9c869, #b8902c); border-color: var(--gold-2); }
.switch input:checked + .knob::after { transform: translateX(20px); background: #fff8e0; }
.switch input:focus-visible + .knob { outline: 2px solid var(--gold-2); outline-offset: 2px; }

.credits-panel { width: min(560px, 100%); }
.credits-pre { margin: 0; padding: 12px 14px; border-radius: 10px; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08);
  font: 12.5px/1.5 Consolas, monospace; color: var(--text); white-space: pre-wrap; word-break: break-word; max-height: 30vh; overflow: auto; user-select: text; }

@media (max-width: 560px) {
  .set-tab em { display: none; } .set-tab span { font-size: 22px; }
  .set-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .set-ctl { justify-content: flex-start; } .set-ctl select { width: 100%; } .slide { width: 100%; }
  .panel { padding: 20px 16px; }
  .settings-panel .panel-foot { flex-wrap: wrap; } .settings-panel .panel-foot .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.enter, .logo .suits, .logo .suits i, .logo h1, .logo-sub, .menu-buttons .btn, .menu-foot, .set-body { animation: none !important; }
  .btn, .chip-btn, .switch .knob::after { transition: none; }
}
.logo h1.small { font-size: clamp(40px, 6vw, 72px); }

/* ---------------------------------------------------------------- character picker (Settings > Game) */
.char-row { flex-direction: column; align-items: stretch; gap: 10px; }
.char-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.char-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 8px 6px; width: 88px; cursor: pointer; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.35); transition: transform .12s, border-color .15s, background .15s; }
.char-opt:hover { transform: translateY(-2px); border-color: var(--panel-border); }
.char-opt.sel { border-color: var(--gold); background: linear-gradient(180deg, rgba(212,175,55,.25), rgba(212,175,55,.05)); }
.char-opt img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(0,0,0,.6); }
.char-opt span { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.char-opt.sel span { color: var(--gold-2); }

/* ---------------------------------------------------------------- winning hand strip */
#besthand { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none; transition: opacity .35s; }
#besthand.show { opacity: 1; }
#besthand .bh-title { font: 700 18px Georgia, serif; color: var(--gold-2); text-shadow: 0 2px 12px rgba(0,0,0,.9); padding: 4px 14px; border-radius: 20px; background: rgba(0,0,0,.55); }
#besthand .bh-cards { display: flex; gap: 8px; }
#besthand img { width: 74px; border-radius: 7px; box-shadow: 0 0 0 2px #ffd24a, 0 0 22px rgba(255,210,74,.75), 0 10px 24px rgba(0,0,0,.6); }
#besthand.show img { animation: bhIn .45s cubic-bezier(.2,1.4,.4,1) backwards; }
@keyframes bhIn { from { opacity: 0; transform: translateY(18px) scale(.8); } }
@media (max-width: 760px) { #besthand img { width: 52px; } }

/* ---------------------------------------------------------------- local multiplayer */
.lm-sub { margin: 0; color: var(--muted); font-size: 13px; }
.lm-names { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.lm-name { display: grid; grid-template-columns: 28px 1fr 32px; gap: 8px; align-items: center; }
.lm-n { font: 700 16px Georgia, serif; color: var(--gold); text-align: center; }
.lm-gap { margin-top: 18px !important; }
.lm-bots { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lm-botn { font: 700 22px Georgia, serif; color: var(--gold-2); min-width: 26px; text-align: center; }
.lm-hint { color: var(--muted); font-size: 12.5px; }
.lm-lvl.off { opacity: .45; }
.lm-total { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.lm-total b { color: var(--gold-2); }
.privacy-change { font: 700 15px 'Segoe UI', sans-serif; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); padding: 6px 16px; border: 1px solid var(--panel-border); border-radius: 30px; }
.privacy-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.panel .two label, .panel .two input { min-width: 0; width: 100%; }

/* ---------------------------------------------------------------- profile picture picker */
.av-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.av-pick.fun { margin-top: 4px; }
.av-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; padding: 6px 4px 5px; cursor: pointer; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.35); transition: transform .12s, border-color .15s; }
.av-opt:hover { transform: translateY(-2px); border-color: var(--panel-border); }
.av-opt.sel { border-color: var(--gold); background: linear-gradient(180deg, rgba(212,175,55,.25), rgba(212,175,55,.05)); }
.av-opt img, .av-opt i { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 24px; font-style: normal; background: rgba(255,255,255,.06); }
.av-opt span { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.15; }
.av-opt.sel span { color: var(--gold-2); }
.av-upload i { border: 1px dashed var(--panel-border); }
.av-mini { padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.35); cursor: pointer; font-size: 12px; }
.av-mini:hover { border-color: var(--gold); }
/* Settings: only the options area scrolls; header, tabs and footer never overlap it. */
.settings-panel > * { flex-shrink: 0; }
.settings-panel .set-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }

/* ---------------------------------------------------------------- 3D character preview & look chooser */
.look-top { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.char-preview { width: 150px; height: 190px; border-radius: 14px; background: radial-gradient(ellipse at 50% 35%, rgba(212,175,55,.22), rgba(0,0,0,.45) 70%); border: 1px solid var(--panel-border); flex-shrink: 0; }
.lm-name { grid-template-columns: 28px 46px 1fr 32px; }
.lm-look { position: relative; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 2px solid var(--panel-border); background: rgba(0,0,0,.4); cursor: pointer; overflow: visible; }
.lm-look img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.lm-look em { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #1d1404; font: 700 11px/18px sans-serif; font-style: normal; text-align: center; }
.lm-look:hover { border-color: var(--gold); }
.modal-box.look-modal { max-width: 760px; width: 100%; text-align: left; max-height: calc(100vh - 32px); overflow-y: auto; }
.look-box h3 { margin-bottom: 12px; }
.look-box h4 { margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
