
:root{--gold:#c9a227;--parch:#efdfbd;--sea:#0d3541;--sea2:#1b5f70}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{font-family:'Trebuchet MS',system-ui,sans-serif;background:#0b0f12;color:var(--parch);overscroll-behavior:none}
button,select,input{font:inherit;color:inherit}
button{background:linear-gradient(#5b3a1c,#33200e);border:1px solid #8a6a2f;border-radius:8px;padding:9px 12px;cursor:pointer;color:#f3e7d0;box-shadow:0 2px 0 #0006,inset 0 1px 0 #ffffff22}
button:active{transform:translateY(1px)}
button:disabled{opacity:.4}
button.gold{background:linear-gradient(#d8b03c,#a37c1c);color:#231404;border-color:#e9c35a;font-weight:700}
input,select{background:#2c1a0e;border:1px solid #8a6a2f;border-radius:8px;padding:9px;width:100%}
.screen{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:22px;gap:12px}
.logo{font-size:34px;letter-spacing:9px;font-weight:900;color:var(--gold);text-shadow:0 3px 0 #000}
.sub{color:#a9967a;font-size:13px;text-align:center;max-width:330px;line-height:1.5}
.card{background:linear-gradient(#2a1a0d,#170d05);border:1px solid #8a6a2f;border-radius:14px;padding:16px;width:100%;max-width:360px;display:flex;flex-direction:column;gap:10px}
.hud{display:flex;align-items:center;gap:6px;padding:7px 9px;background:linear-gradient(#4a3018,#25150a);border-bottom:2px solid var(--gold);position:sticky;top:0;z-index:9}
.hud .code{font-family:monospace;letter-spacing:2px;background:#0009;padding:3px 7px;border-radius:5px;color:var(--gold);font-size:12px}
.hud .grow{flex:1}
.hud button{padding:6px 9px;font-size:12px}
.seats{display:flex;gap:5px;padding:6px;overflow-x:auto;background:#0b151a;scrollbar-width:none}
.seats::-webkit-scrollbar{display:none}
.seat{flex:0 0 auto;min-width:86px;border-radius:9px;padding:5px 7px;background:#16262e;border-left:4px solid #666;font-size:11px;position:relative}
.seat.turn{outline:2px solid var(--gold);background:#1e3540}
.seat.off{opacity:.45}
.seat b{display:block;font-size:11.5px;margin-bottom:3px}
.seat .rs{color:#b9ccd4;line-height:1.5;font-size:10.5px}
.seat .pts{position:absolute;top:4px;right:5px;background:var(--gold);color:#231404;border-radius:4px;padding:0 4px;font-weight:800;font-size:10px}
#board{display:block;width:100%;height:auto;background:radial-gradient(circle at 50% 45%,var(--sea2),var(--sea));touch-action:manipulation}
.hex polygon{stroke:#08262d;stroke-width:1.6}
.hex .terrain{pointer-events:none;clip-path:polygon(50% 0%,100% 25%,100% 75%,50% 100%,0% 75%,0% 25%)}
.hex polygon{fill:transparent}
.hex[data-res="wood"] polygon{fill:url(#g-wood)}
.hex[data-res="sheep"] polygon{fill:url(#g-sheep)}
.hex[data-res="wheat"] polygon{fill:url(#g-wheat)}
.hex[data-res="brick"] polygon{fill:url(#g-brick)}
.hex[data-res="ore"] polygon{fill:url(#g-ore)}
.hex[data-res="desert"] polygon{fill:url(#g-desert)}
.hit{fill:transparent;cursor:pointer}
.roadline{stroke-linecap:round;stroke-width:7}
.roadback{stroke:#160c04;stroke-linecap:round;stroke-width:11}
.house{stroke:#160c04;stroke-width:2}
.tok{fill:#f3e7d0;stroke:#7d5f26;stroke-width:1.5}
.tokt{font-weight:800;font-size:14px;text-anchor:middle;fill:#231404;pointer-events:none}
.tokt.red{fill:#b3261e}
.pips{font-size:5.5px;text-anchor:middle;fill:#6b5a3a;pointer-events:none}
.robber{fill:#111;stroke:var(--gold);stroke-width:1.5}
.portc{fill:#0a2a33;stroke:var(--gold);stroke-width:1.3}
.portt{font-size:8px;font-weight:800;text-anchor:middle;fill:var(--gold);pointer-events:none}
.dock{padding:8px;display:flex;flex-direction:column;gap:8px;background:#0d1519;border-top:1px solid #ffffff14}
.dock .row{display:flex;gap:6px;flex-wrap:wrap}
.dock .row button{flex:1;min-width:100px;font-size:12.5px;padding:10px 6px}
.hand{display:flex;gap:6px;flex-wrap:wrap}
.chip{background:#1b2c33;border:1px solid #ffffff1a;border-radius:8px;padding:5px 9px;font-size:12px;display:flex;gap:5px;align-items:center}
.chip b{color:var(--gold)}
.log{max-height:112px;overflow:auto;background:#080f13;font-size:11px;padding:7px;line-height:1.55;color:#9fb4bd}
.dice{display:flex;gap:8px;align-items:center;justify-content:center;padding:6px}
.die{width:40px;height:40px;border-radius:9px;background:#f3e7d0;color:#231404;display:grid;place-items:center;font-weight:900;font-size:20px;box-shadow:0 3px 0 #0007}
.die.sm{width:32px;height:32px;font-size:16px}
.adminbox{background:#1a1206;border:1px solid #8a6a2f;border-radius:10px;padding:9px;display:flex;flex-direction:column;gap:6px;font-size:12px}
.adminbox h4{margin:0;font-size:10px;letter-spacing:1.5px;color:var(--gold);text-transform:uppercase}
.arow{display:flex;align-items:center;gap:5px}
.arow span{flex:1}
.arow button{padding:2px 9px;min-width:0;flex:0 0 auto}
.arow b{width:20px;text-align:center;color:var(--gold)}
.toast{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:#000d;border:1px solid var(--gold);padding:9px 15px;border-radius:9px;font-size:12.5px;opacity:0;transition:.2s;pointer-events:none;z-index:99;max-width:88vw;text-align:center}
.toast.on{opacity:1}
.qr{background:#fff;padding:9px;border-radius:10px;width:190px;height:190px;display:grid;place-items:center}
.linkbox{font-family:monospace;font-size:12px;background:#0009;padding:8px;border-radius:7px;word-break:break-all;text-align:center;color:var(--gold)}
.big{font-size:26px;font-weight:900;letter-spacing:4px;color:var(--gold);text-align:center}
.warn{color:#e8a33c;font-size:11.5px;text-align:center;line-height:1.5}
@media(min-width:760px){.wrap{max-width:760px;margin:0 auto;border-left:1px solid #ffffff14;border-right:1px solid #ffffff14;min-height:100vh;display:flex;flex-direction:column}}
#board{width:100%;height:min(62vh,700px);background:radial-gradient(circle,#1c6975,#0b303b);touch-action:manipulation}.hexhit{fill:transparent;stroke:#102b2e;stroke-width:2;cursor:pointer}.token{fill:#f1dfb8;stroke:#795d2d;stroke-width:1.5}.token.red{fill:#f0c5a7}.number{font-weight:900;text-anchor:middle;fill:#302313;pointer-events:none}.road{stroke:#ffffff20;stroke-width:7;stroke-linecap:round}.road.p0{stroke:#d64b3f}.road.p1{stroke:#3b8fd0}.road.p2{stroke:#e8c73c}.road.p3{stroke:#3fae63}.road.p4{stroke:#9b59c9}.road.p5{stroke:#e08a2e}.road.p6{stroke:#22a89b}.road.p7{stroke:#d3599b}.edgehit{stroke:transparent;stroke-width:14;cursor:pointer}.wrap{max-width:900px;margin:auto}.log{max-height:120px;overflow:auto}.screen h1{color:var(--gold)}
.vertexhit{fill:transparent;stroke:transparent;cursor:pointer}
.winner{padding:12px;border:1px solid var(--gold);border-radius:10px;text-align:center;color:var(--gold);font-size:20px;font-weight:800;background:#30220d}
.resource-icon{width:25px;height:25px;object-fit:contain;vertical-align:middle}.hand .chip{padding:3px 6px;gap:3px}#acts input{width:72px}.card label{display:flex;align-items:center;justify-content:space-between;gap:12px}.card label input,.card label select{width:auto;flex:1}

/* Table layout: player areas surround the shared map. */
.wrap{max-width:1440px;min-height:100vh;margin:0 auto;background:radial-gradient(ellipse at 50% 40%,#17323a,#0b1115 72%)}
.game-title{font-weight:900;letter-spacing:4px;color:var(--gold)}
.table-grid{display:grid;grid-template-columns:minmax(145px,1fr) minmax(420px,3fr) minmax(145px,1fr);grid-template-rows:minmax(100px,auto) minmax(430px,62vh) minmax(100px,auto);grid-template-areas:'nw north ne' 'west map east' 'sw south se';gap:8px;padding:12px;align-items:center}
.board-area{grid-area:map;position:relative;min-width:0;align-self:stretch;border:1px solid #70a6a444;border-radius:18px;overflow:hidden;background:radial-gradient(ellipse,#1e6673,#0a2d37 73%);box-shadow:inset 0 0 60px #07191d}
.board-label{position:absolute;z-index:2;left:12px;top:10px;padding:5px 9px;border-radius:7px;background:#06181dcc;color:#f0d88b;font-size:11px;letter-spacing:1.4px;font-weight:800}
#board{display:block;width:100%;height:100%;min-height:430px;background:transparent;touch-action:manipulation}
.player-card{z-index:3;min-width:0;padding:9px 10px;border:1px solid color-mix(in srgb,var(--player),transparent 40%);border-left:4px solid var(--player);border-radius:12px;background:linear-gradient(145deg,#26343a,#111a1e 85%);box-shadow:0 7px 20px #0007}
.player-card header{display:flex;align-items:center;gap:6px;font-size:13px;min-width:0}.player-card header>i{width:9px;height:9px;flex:none;border-radius:50%;background:var(--player);box-shadow:0 0 9px var(--player)}.player-card header>b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.points{margin-left:auto;color:#f5d46e;white-space:nowrap;font-weight:800;font-size:12px}.player-card small{display:block;color:#a8bac0;font-size:10px;margin-top:4px}
.seat-0{grid-area:north}.seat-1{grid-area:east}.seat-2{grid-area:south}.seat-3{grid-area:west}.seat-4{grid-area:nw}.seat-5{grid-area:ne}.seat-6{grid-area:se}.seat-7{grid-area:sw}.active-turn{outline:2px solid #f1cc59;box-shadow:0 0 20px #eac84944,0 7px 20px #0008}
.resource-cards{display:flex;align-items:center;gap:3px;min-height:43px;margin-top:5px;overflow:hidden}.resource-card{position:relative;width:40px;height:41px;flex:none}.resource-card span{position:relative;display:block;height:100%}.resource-card img{position:absolute;inset:0;width:37px;height:41px;object-fit:cover;border-radius:4px;box-shadow:0 2px 4px #0008}.resource-card img:nth-child(2){transform:translate(2px,-2px)}.resource-card img:nth-child(3){transform:translate(4px,-4px)}.resource-card b{position:absolute;right:-2px;bottom:-2px;min-width:17px;text-align:center;padding:1px 3px;border-radius:9px;background:#f6d773;color:#30230e;font-size:10px;box-shadow:0 1px 4px #000}.hidden-cards{position:relative}.hidden-cards>img{width:27px;height:38px;object-fit:cover;margin-left:-11px;border-radius:4px}.hidden-cards>img:first-child{margin-left:0}.hidden-cards>b{margin-left:auto;color:#f5d46e}
.note{display:block;width:100%;min-height:35px;max-height:80px;margin-top:6px;padding:5px 7px;resize:vertical;border-color:#ffffff20;background:#10191c;color:#e6d9b8;font-size:11px}
.hex-outline{fill:transparent;stroke:#08262d;stroke-width:1.5;pointer-events:none}.hex-hit{fill:transparent;stroke:transparent;cursor:pointer}.number-token{fill:#f2e1c3;stroke:#755a30;stroke-width:1.4}.number-token.hot{fill:#efc3a5}.number-token.rolled{fill:#ffe45c;stroke:#fff4ad;stroke-width:3;filter:drop-shadow(0 0 9px #ffe64f)}.number-text{fill:#2e2417;text-anchor:middle;font-size:12px;font-weight:900;pointer-events:none}.number-text.rolled{font-size:14px}.token-pips{fill:#59472d;text-anchor:middle;font-size:5px;pointer-events:none}.port{fill:#07232a;stroke:#e7c659;stroke-width:1.5}.port-text{fill:#ffe28a;text-anchor:middle;font-size:7px;font-weight:bold;pointer-events:none}.road{stroke:#ffffff1c;stroke-width:7;stroke-linecap:round;pointer-events:none}.road-0{stroke:#d64b3f}.road-1{stroke:#3b8fd0}.road-2{stroke:#e8c73c}.road-3{stroke:#3fae63}.road-4{stroke:#9b59c9}.road-5{stroke:#e08a2e}.road-6{stroke:#22a89b}.road-7{stroke:#d3599b}.edge-hit{stroke:transparent;stroke-width:14;cursor:pointer}.vertex-hit{fill:transparent;stroke:transparent;cursor:pointer}.building{stroke:#fff;stroke-width:2;pointer-events:none}.building.city{stroke-width:3}
.dock{display:flex;flex-direction:column;gap:9px;padding:12px;background:#101a1e;border-top:1px solid #d4b45566}.dice-panel{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 10px;background:#1e2d32;border:1px solid #ffffff16;border-radius:10px}.dice-panel strong{font-size:20px;color:#f6d773}.dice-panel .phase{margin-left:auto;color:#9fb4bd}.manual-dice,.row{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.manual-dice input{width:88px}.admin-console{padding:12px;border:1px solid #b98f39;border-radius:12px;background:linear-gradient(140deg,#302515,#19170f)}.admin-heading{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:10px}.admin-heading b,.admin-heading small{display:block}.admin-heading small,.command-box small{color:#b9aa88;font-size:11px;margin-top:4px}.admin-heading select{max-width:220px}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.command-box,.quick-transfer{display:flex;flex-direction:column;gap:7px}.command-box>input{font-family:monospace;letter-spacing:1px}.quick-transfer .row>*{min-width:90px;flex:1}.command-box code{color:#ffe18a}.status{padding:8px 10px;border-radius:8px;background:#17262a;color:#e3d5b2}.discard-input{display:grid;grid-template-columns:1fr 90px;align-items:center;gap:8px}.discard-input input{width:90px}.log{max-height:100px;overflow:auto;padding:7px;border-radius:8px;background:#080f13;color:#9fb4bd;font-size:11px;line-height:1.5}.spectator .hud{position:sticky;top:0}.spectator .table-grid{grid-template-rows:minmax(105px,auto) minmax(510px,72vh) minmax(105px,auto)}.spectator #board{min-height:510px}.winner{margin:8px auto;max-width:500px;padding:12px;border:1px solid var(--gold);border-radius:10px;text-align:center;color:var(--gold);font-size:20px;font-weight:800;background:#30220d}
@media(max-width:850px){.table-grid{grid-template-columns:minmax(110px,1fr) minmax(0,2.2fr) minmax(110px,1fr);grid-template-rows:auto minmax(390px,54vh) auto;gap:5px;padding:6px}.player-card{padding:7px}.player-card header{font-size:11px}.resource-card{width:30px;height:34px}.resource-card img{width:29px;height:34px}.resource-cards{min-height:37px}.player-card small{font-size:9px}.spectator .table-grid{grid-template-rows:auto minmax(440px,64vh) auto}}
@media(max-width:600px){.table-grid{display:flex;flex-direction:column;align-items:stretch}.board-area{order:0;min-height:58vh}.player-card{width:100%;order:1}.seat-0,.seat-1,.seat-2,.seat-3,.seat-4,.seat-5,.seat-6,.seat-7{grid-area:auto}.player-card header{font-size:13px}.resource-card{width:40px;height:41px}.resource-card img{width:37px;height:41px}.resource-cards{min-height:44px}.admin-grid{grid-template-columns:1fr}.hud{flex-wrap:wrap}.dice-panel .phase{margin-left:0}.spectator .table-grid{display:grid;grid-template-columns:1fr 1fr}.spectator .board-area{grid-column:1/-1;grid-row:1;min-height:62vh}.spectator .player-card{width:auto}.spectator .seat-0,.spectator .seat-1,.spectator .seat-2,.spectator .seat-3,.spectator .seat-4,.spectator .seat-5,.spectator .seat-6,.spectator .seat-7{grid-area:auto}}
.spectator .points,.spectator .player-card small{display:none}.spectator .player-card{min-height:70px}.spectator .resource-cards{margin-bottom:0}
.lobby-qr{width:240px;height:240px;padding:10px;display:grid;place-items:center;background:#fff;border-radius:14px;box-shadow:0 10px 35px #0008}.lobby-qr img{width:100%;height:100%;image-rendering:pixelated}.lobby-qr span{color:#352719;text-align:center;font-size:13px}.network-select{width:min(100%,360px);display:grid;gap:6px;color:#c4b38c;font-size:12px}.network-select select{width:100%}

.dev-hand{display:flex;gap:5px;overflow-x:auto;padding:5px 1px 3px;scrollbar-width:thin}.dev-card{position:relative;display:flex;flex:0 0 76px;width:76px;height:102px;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:5px;border:1px solid #d9bd6a;border-radius:8px;background:linear-gradient(155deg,#f3e6bf,#bfa76d);color:#332715;text-align:center;box-shadow:0 3px 7px #0008;white-space:normal}.dev-card:disabled{opacity:1;cursor:default}.dev-card small{display:block;margin:0;color:#63512c;font-size:6px;letter-spacing:.4px}.dev-card>b{font-size:24px;line-height:1.1}.dev-card strong{font-size:9px;line-height:1.1}.dev-card span{font-size:7px;line-height:1.1;color:#53462f}.dev-vp{background:linear-gradient(145deg,#fff0a5,#d6a93e)}.dev-monopoly{background:linear-gradient(145deg,#ffe1c3,#c68848)}.dev-roadBuilding{background:linear-gradient(145deg,#e2d3a8,#849c7a)}.hidden-dev{align-items:center}.dev-back{background:repeating-linear-gradient(45deg,#244d57,#244d57 5px,#17333c 5px,#17333c 10px);color:#f4d66d;font-size:27px;font-weight:900;border-color:#e0bd54}.dev-extra{align-self:center;color:#f5d46e;font-size:12px}.own-player{box-shadow:0 0 0 2px #f4d66d55,0 7px 20px #0008}.admin-console .quick-transfer .row>*{min-width:90px;flex:1}
.spectator .points{display:inline}.spectator .player-card small{display:block}
@media(max-width:600px){.table-grid{display:flex;flex-direction:column;align-items:stretch}.board-area{order:0;min-height:58vh}.player-card{width:100%;order:1}.player-card.own-player{order:2}.dev-card{flex-basis:72px;width:72px;height:96px}}
.modal{position:fixed;z-index:50;left:50%;top:50%;transform:translate(-50%,-50%);width:min(92vw,380px);max-height:88vh;overflow:auto;box-shadow:0 18px 70px #000c}
