:root{--bg:#0b0f14;--panel:#141b24;--line:#243040;--text:#e8eef5;--mut:#8ea0b5;--gold:#e8b94a;--felt:#0f5c3a;--felt2:#0a3d27;--red:#a52832}
*{box-sizing:border-box}
body{margin:0;background:radial-gradient(circle at 50% -20%,#1b2a3b,#0b0f14 60%) fixed;color:var(--text);font:15px system-ui,sans-serif;min-height:100vh}
#app{max-width:1100px;margin:0 auto;padding:16px}
h1,h2{margin:.2em 0}
button{background:var(--gold);color:#201a05;border:0;border-radius:8px;padding:9px 16px;font-weight:700;cursor:pointer}
button:disabled{opacity:.35;cursor:default}
button.ghost{background:transparent;color:var(--text);border:1px solid var(--line)}
input,select{background:#0e141b;border:1px solid var(--line);color:var(--text);border-radius:8px;padding:9px 12px;font:inherit}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:20px}
.center{max-width:340px;margin:12vh auto;display:flex;flex-direction:column;gap:10px;text-align:center}
.row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:center}
.bar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.mut{color:var(--mut)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin:14px 0}
.tcard{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:14px;cursor:pointer}
.tcard:hover{border-color:var(--gold)}
.term{background:#05080b;border:1px solid var(--line);border-radius:10px;padding:12px;min-height:300px;max-height:55vh;overflow:auto;white-space:pre-wrap;font:13px Consolas,monospace}
#toasts{position:fixed;right:14px;bottom:14px;display:flex;flex-direction:column;gap:8px;z-index:9}
.toast{background:#1d2733;border-left:4px solid var(--gold);padding:10px 14px;border-radius:8px;max-width:320px}
.toast.err{border-color:#e5484d}
.modal{position:fixed;inset:0;background:#000a;display:flex;align-items:center;justify-content:center;z-index:8}
.modal .panel{max-width:480px;width:92%;white-space:pre-wrap}
.modal .panel{max-height:90vh;overflow:auto}
.modal .panel.modal-wide{max-width:900px}
/* table frame */
.timer{flex:1;min-width:140px;display:flex;align-items:center;gap:10px}
.track{flex:1;height:8px;background:#0e141b;border-radius:4px;overflow:hidden}
.fill{height:100%;background:var(--gold);width:0}
.msg{text-align:center;margin:10px 0;font-size:17px;min-height:24px}
.wait{text-align:center;color:var(--mut);min-height:20px}
.controls{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:center;margin-top:14px}
/* cards */
.felt{background:radial-gradient(ellipse at center,var(--felt),var(--felt2));border:8px solid #5a3a1a;border-radius:28px;padding:20px;min-height:380px}
.label{color:#cfe8da;text-align:center;margin-bottom:6px}
.hand{display:flex;justify-content:center;min-height:96px;padding-right:28px}
.slot{width:64px;height:92px;margin-right:-26px;perspective:600px}
.slot.deal{animation:deal .45s ease-out}
@keyframes deal{from{transform:translate(260px,-180px) rotate(30deg);opacity:0}}
.card{width:100%;height:100%;position:relative;transform-style:preserve-3d;transition:transform .5s}
.card.hidden{transform:rotateY(180deg)}
.face{position:absolute;inset:0;border-radius:8px;backface-visibility:hidden;display:flex;align-items:center;justify-content:center;font:700 22px Georgia,serif;box-shadow:0 2px 6px #0008}
.front{background:#fff;color:#111}.front.red{color:var(--red)}
.back{background:repeating-linear-gradient(45deg,#7a1f2b 0 6px,#5a1620 6px 12px);border:3px solid #fff;transform:rotateY(180deg)}
.seats{display:flex;gap:18px;justify-content:center;flex-wrap:wrap;margin-top:34px}
.seat{padding:10px 14px;border-radius:14px;border:2px solid transparent;text-align:center;min-width:150px}
.seat.turn{border-color:var(--gold);box-shadow:0 0 18px #e8b94a88}
.seat.me .nm{color:var(--gold)}
.nm{font-weight:700;margin-bottom:4px}
.player-identity{position:relative;display:flex;align-items:center;justify-content:center;gap:8px;min-height:34px;padding:4px 10px;z-index:0}
.player-identity:hover{z-index:1000}
.player-name{position:relative;z-index:1}
.player-title{color:var(--gold);font-size:12px;line-height:1.2}
.player-icon{width:32px;height:32px;object-fit:cover;border-radius:50%;position:relative;z-index:1}
.player-border{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;z-index:0}
.equipped-rarity-tooltip{display:none;position:absolute;left:50%;top:100%;transform:translateX(-50%);z-index:2;min-width:max-content;padding:7px 10px;background:#080c11;border:1px solid var(--line);border-radius:8px;box-shadow:0 4px 14px #000b;text-align:left}
.player-identity:hover .equipped-rarity-tooltip{display:flex;flex-direction:column;gap:4px}
.rarity-name{font-weight:800}
.rarity-1{color:#9b6a43}.rarity-2{color:#b0b7c3}.rarity-3{color:#50c878}.rarity-4{color:#4da3ff}.rarity-5{color:#bf66ff}
.rarity-6{color:#ff9d3d}.rarity-7{color:#ff5252}.rarity-8{color:#ffe066}.rarity-9{color:#55e6e6}.rarity-10{color:#ff78d2}
.rarity-bg-1{background-color:#38271e;border-color:#795436}.rarity-bg-2{background-color:#242a32;border-color:#626c7a}
.rarity-bg-3{background-color:#153426;border-color:#318653}.rarity-bg-4{background-color:#142b45;border-color:#347bb7}
.rarity-bg-5{background-color:#301b42;border-color:#8244a8}.rarity-bg-6{background-color:#422817;border-color:#bc6d25}
.rarity-bg-7{background-color:#411d25;border-color:#b43c4a}.rarity-bg-8{background-color:#443a18;border-color:#b99a30}
.rarity-bg-9{background-color:#153a40;border-color:#31a0a7}.rarity-bg-10{background-color:#411a39;border-color:#b44a98}
.special-rarity{background-image:linear-gradient(115deg,#ff3b30,#ff9f0a,#ffd60a,#34c759,#0a84ff,#bf5af2,#ff2d55);background-size:300% 300%;animation:rainbow-rarity 5s linear infinite}
.rarity-name.special-rarity{color:#fff;background-color:transparent;background-image:linear-gradient(90deg,#ff3b30,#ff9f0a,#ffd60a,#34c759,#0a84ff,#bf5af2,#ff2d55);background-size:300% 100%;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:rainbow-rarity 5s linear infinite}
@keyframes rainbow-rarity{0%{background-position:0% 50%}100%{background-position:100% 50%}}
.roulette-player{display:inline-flex;align-items:center;margin-right:10px}
.info{color:#cfe8da;min-height:20px;margin-top:4px}
.chip{width:46px;height:46px;border-radius:50%;border:4px dashed #fffb;color:#fff;font-weight:800;padding:0;box-shadow:0 2px 5px #0009}
.chip.sel{outline:3px solid var(--gold);outline-offset:2px}
/* roulette */
.rl{display:grid;grid-template-columns:420px 1fr;gap:18px;align-items:start}
@media(max-width:900px){.rl{grid-template-columns:1fr}}
.wheel{max-width:100%;height:auto}
.rtable{display:grid;grid-template-columns:44px repeat(12,1fr);grid-template-rows:repeat(3,44px);gap:3px}
.cell{position:relative;border:1px solid #ffffff55;border-radius:5px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;cursor:pointer;background:var(--felt2);user-select:none}
.cell.red{background:var(--red)}.cell.black{background:#15191f}.cell.green{background:#0f7a48}
.cell:hover{outline:2px solid var(--gold)}
.cell.win{outline:3px solid #fff;animation:pulse .7s infinite alternate}
@keyframes pulse{to{filter:brightness(1.7)}}
.mark{position:absolute;top:-7px;right:-7px;min-width:22px;height:22px;padding:0 3px;border-radius:50%;background:var(--gold);color:#201a05;font-size:11px;display:flex;align-items:center;justify-content:center;border:2px dashed #fff9}
.outside{display:grid;grid-template-columns:repeat(6,1fr);gap:3px;margin-top:3px;padding-left:47px}
.outside .cell{height:40px}
.hist{display:flex;gap:5px;flex-wrap:wrap;margin:10px 0}
.hist span{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;color:#fff}
.hist .red{background:var(--red)}.hist .black{background:#15191f}.hist .green{background:#0f7a48}
/* economy / stats */
.badge{font-size:12px;padding:2px 9px;border-radius:99px;border:1px solid var(--line);color:var(--mut);text-transform:uppercase}
.badge.live{color:#5ae88b;border-color:#5ae88b}.badge.upcoming{color:var(--gold);border-color:var(--gold)}
.mission .track{height:10px}
.lb{width:100%;border-collapse:collapse}.lb td{padding:6px 10px;border-bottom:1px solid var(--line)}
.lb-player-button{background:transparent;color:inherit;padding:0;border:0;font:inherit;text-align:left}
.lb-player-button:hover{color:var(--gold);text-decoration:underline}
.lb th{text-align:left;padding:6px 10px;color:var(--mut);border-bottom:1px solid var(--line)}
.lb th.num{text-align:right}
.lb tr.me td{color:var(--gold);font-weight:700}.num{text-align:right}.up{color:#5ae88b}.down{color:#e5484d}
.statgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;margin:12px 0}
.stat{background:#0e141b;border-radius:10px;padding:10px}
.graph-players{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 14px;max-height:180px;overflow:auto}
.graph-legend-color{width:10px;height:10px;display:inline-block;flex:none}
.tournament-standings{display:flex;flex-wrap:wrap;gap:8px 16px}
.event-leader{display:inline-flex;align-items:center}
.graph-player{display:flex;align-items:center;gap:6px;background:#0e141b;border:1px solid var(--line);border-radius:8px;padding:6px 9px}
.graph-player input{margin:0}
.form{display:flex;flex-direction:column;gap:10px}
.form label{display:flex;justify-content:space-between;align-items:center;gap:12px}.form input{width:110px}
.form label[hidden]{display:none}
.form input[type=file]{width:min(260px,60vw)}
.shop-item{text-align:center;display:flex;flex-direction:column;gap:8px;align-items:center}
.player-tile{text-align:left;color:var(--text);background:var(--panel);border:1px solid var(--line)}
.player-tile:hover{border-color:var(--gold)}.player-tile.selected{border-color:var(--gold)}
.player-preview{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.shop-item[draggable=true]{cursor:grab}.shop-item[draggable=true]:active{cursor:grabbing}
.shop-border-preview{width:110px;height:56px;object-fit:fill}
.shop-prize{display:flex;align-items:center;justify-content:center;gap:12px}
.chest-opening{overflow:hidden}
.chest-roll-label{text-align:center;margin-bottom:10px}
.chest-roll-window{position:relative;overflow:hidden;padding:10px 0;border-block:1px solid var(--line)}
.chest-roll-marker{position:absolute;z-index:2;top:0;bottom:0;left:50%;width:3px;background:#fff;box-shadow:0 0 8px #fff;transform:translateX(-50%);pointer-events:none}
.chest-roll-track{display:flex;gap:8px;width:max-content;transform:translateX(0)}
.chest-roll-track.rolling{transition:transform 3.8s cubic-bezier(.08,.78,.12,1)}
.chest-roll-item{width:120px;height:112px;flex:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:8px;border:1px solid var(--line);border-radius:10px;text-align:center;overflow:hidden}
.chest-roll-item>*:first-child{max-width:90px;max-height:56px;overflow:hidden}
.chest-roll-item img{max-width:90px;max-height:56px;object-fit:contain}
.chest-roll-item b{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chest-opening .shop-prize{margin-top:12px}
.chest-opening .shop-prize[hidden]{display:none}
@media(prefers-reduced-motion:reduce){.chest-roll-track.rolling{transition:none}}
.admin-item{display:flex;flex-direction:column;gap:8px}
.admin-item .bar{margin:0}
.chest-drop-list{display:flex;flex-direction:column;gap:8px}
.chest-drop-option{padding:8px;border:1px solid var(--line);border-radius:8px}
.chest-item-tools{display:grid;grid-template-columns:minmax(180px,1fr) minmax(180px,auto);gap:8px;align-items:center}
.chest-item-tools>input[type=search]{width:100%}
.chest-item-tools label{margin:0}
.chest-item-tools label select{width:auto}
.chest-item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;max-height:48vh;overflow:auto;padding:2px}
.chest-item-tile{display:flex;flex-direction:column;gap:8px;align-items:center;padding:12px;border:1px solid var(--line);border-radius:12px;text-align:center;min-width:0}
.chest-item-select{display:flex;align-items:center;justify-content:center;gap:8px}
.chest-item-select input{width:auto}
.chest-item-preview{height:72px;max-width:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}
.chest-item-preview .player-title{max-width:100%;overflow-wrap:anywhere}
.chest-item-preview .player-icon,.chest-item-preview .shop-border-preview{max-width:110px;max-height:68px;object-fit:contain}
.chest-item-tile label{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;font-size:13px}
.chest-item-tile label input[type=number]{width:90px}
.chest-drop-option label{display:flex;align-items:center;justify-content:flex-start}
.chest-drop-option label input{width:auto}
.title-editor-field{display:flex;flex-direction:column;gap:8px}
.title-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.title-toolbar select,.title-toolbar input{width:auto;min-height:36px}
.title-toolbar input[type=color]{padding:3px;width:44px}
.title-editor{min-height:88px;padding:10px;background:#0e141b;border:1px solid var(--line);border-radius:8px;outline:none;overflow-wrap:anywhere}
.title-editor:focus{border-color:var(--gold)}
.title-editor:empty:before{content:"Enter a title and format it with the controls above";color:var(--mut)}
.shop-admin-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 0;border-bottom:1px solid var(--line)}
.admin-actions{flex-wrap:wrap}
/* Texas Hold'em */
.poker{text-align:center}
.poker-cards{display:flex;justify-content:center;gap:7px;min-height:74px;margin:10px 0}
.poker-card{width:48px;height:68px;background:#fff;color:#111;border:2px solid #d6d6d6;border-radius:7px;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:20px;box-shadow:0 2px 5px #0008}
.poker-card.red{color:var(--red)}
.poker-card.win{border-color:var(--gold);box-shadow:0 0 0 3px var(--gold),0 0 18px #e8b94a;transform:translateY(-4px)}
.poker-card.back{background:repeating-linear-gradient(45deg,#263d67 0 6px,#172644 6px 12px);color:#fff;border-color:#fff}
.poker-cards.small{min-height:52px}
.poker-cards.small .poker-card{width:36px;height:50px;font-size:16px}
.poker-cards.small .poker-card.win{transform:translateY(-3px)}
.poker-pot{font-size:20px;font-weight:800;color:var(--gold);margin:10px}
.poker-result{background:#153323;border:1px solid var(--gold);border-radius:10px;padding:10px;margin:12px auto;max-width:560px;color:#f5df9c}
.poker-result[hidden]{display:none}
.poker-result>div+div{margin-top:5px}
.poker-players{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:18px 0}
.poker-player{background:#0e141b;border:2px solid var(--line);border-radius:10px;padding:10px}
.poker-player.active{border-color:var(--gold);box-shadow:0 0 14px #e8b94a55}
.poker-player.folded{opacity:.5}
