/* Online portal shares the game's gothic language. Combat keeps the native #game and #hud. */
.so-overlay[hidden]{display:none!important}
.so-overlay{position:fixed;inset:0;z-index:1000;overflow:auto;padding:clamp(18px,5vw,72px);background:radial-gradient(ellipse at center,rgba(29,24,20,.94),rgba(7,6,7,.99)),url('../assets/ui/gothic-panel-frame.png');color:#e8ddc5;font:inherit}
.so-header{display:flex;align-items:center;justify-content:space-between;gap:10px;max-width:900px;margin:auto;border-bottom:1px solid #775c38}
.so-header h2{margin:0;padding:9px 0;color:#d9bc75;font-size:clamp(25px,4vw,42px)}
.so-status{min-height:22px;max-width:900px;margin:16px auto 0;color:#cbb27b}
.so-actions,.so-join{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap}

/* Portal home: three unmixed destinations. */
.so-home{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;max-width:900px;margin:26px auto}
.so-home[hidden],.so-panel[hidden]{display:none!important}
.so-section-card{display:flex;flex-direction:column;gap:8px;align-items:flex-start;padding:22px 18px;text-align:left;color:#e3d3b2;background:linear-gradient(135deg,rgba(30,25,22,.98),rgba(11,10,11,.96));border:1px solid #705537;box-shadow:0 10px 30px #0007;cursor:pointer;font:inherit}
.so-section-card:hover,.so-section-card:focus-visible{border-color:#c9a25e;box-shadow:0 0 22px #c0652f33,0 10px 30px #000}
.so-section-card b{font-family:'Cinzel',Georgia,serif;font-size:22px;color:#e8c777;letter-spacing:1px}
.so-section-card small{color:#b9a98f;font-size:13px;line-height:1.5}
.so-section-index{font:600 12px/1 system-ui,sans-serif;color:#8d7a5c;letter-spacing:3px}

/* Section panels with explicit back navigation. */
.so-panel{max-width:900px;margin:22px auto;box-sizing:border-box;padding:clamp(18px,4vw,32px);background:linear-gradient(135deg,rgba(30,25,22,.98),rgba(11,10,11,.96));border:1px solid #705537;box-shadow:0 14px 50px #0008}
.so-panel-head{display:flex;align-items:center;gap:16px;padding-bottom:12px;margin-bottom:16px;border-bottom:1px solid #4d3a28}
.so-panel-head h2{margin:0;color:#d9bc75;font-size:clamp(20px,3vw,28px)}
.so-back{background:none;border:0;color:#c9a25e;font:inherit;cursor:pointer;padding:4px 2px}
.so-back:hover,.so-back:focus-visible{color:#f3ce74;outline-offset:2px}
.so-panel label,.so-auth label{display:flex;flex-direction:column;gap:7px;margin:10px 0;color:#cfb77f}
.so-overlay input,.so-overlay select{box-sizing:border-box;min-height:38px;padding:8px 10px;color:#eadfc8;background:#131112;border:1px solid #705a3b;font:inherit}
.so-note{line-height:1.65;color:#bbad98;margin:12px 0}
.so-member{margin:6px 0;color:#e2d2ae}
.so-sync{margin:10px 0;color:#9dc9a4}
.so-room{margin-top:18px;padding-top:14px;border-top:1px solid #493827}
.so-room h3{margin:0 0 8px;color:#e8c777;font-family:'Cinzel',Georgia,serif}
.so-auth{margin-top:6px}
.so-boards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.so-board h3{margin:0 0 8px;color:#e8c777;font-family:'Cinzel',Georgia,serif;font-size:18px}
.so-board-body{border-top:1px solid #493827}
.so-rank{padding:8px 0;margin:0;border-bottom:1px solid #332920;color:#ddcfba}

/* Shared upgrade pause: the server owns the clock, the client shows the cards. */
.so-choice[hidden]{display:none!important}
.so-choice{position:fixed;inset:0;z-index:1100;overflow:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:clamp(16px,4vw,48px);background:rgba(7,6,7,.93)}
.so-choice h2{margin:0;color:#e8c777;font-size:clamp(22px,3.4vw,34px)}
.so-choice-timer{margin:0;color:#cbb27b;letter-spacing:.5px}
.so-choice-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;width:min(960px,100%);margin-top:14px}
.so-choice-cards .card{cursor:pointer}
.so-choice-cards .card:disabled{cursor:default;opacity:.65}
.so-choice-cards .card.picked{border-color:#e8c777!important;box-shadow:0 0 26px #d9b35655;opacity:1}

/* Online pause reuses the native overlay but explains why the arena keeps running. */
.so-pause-note[hidden]{display:none!important}
.so-pause-note{max-width:420px;margin:16px 0 0;color:#cbb27b;font-size:13px;line-height:1.5;text-align:center}

/* Applied-choice notice over the native HUD. */
.so-flash{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);padding:10px 18px;color:#f0dfb9;background:linear-gradient(90deg,#1d1713ef,#090807d8);border:1px solid #8b6d43;pointer-events:none;opacity:0;transition:opacity .35s;font-size:14px}
.so-flash.show{opacity:1}

/* Account state on the title screen. */
.ss-account-state{display:block;margin:12px auto 0;padding:8px 14px;color:#cbb27b;background:#131112cc;border:1px solid #705a3b;cursor:pointer;font:inherit}
.ss-account-state[data-state="in"]{color:#e8c777;border-color:#8b6d43}

/* Compact ally frame inside the native HUD. */
.so-ally-frame{position:absolute;top:68px;left:18px;width:190px;min-height:46px;padding:5px 9px 7px 48px;box-sizing:border-box;color:#f0dfb9;background:linear-gradient(90deg,#1d1713ef,#090807b8);border:1px solid #8b6d43;pointer-events:none;font-size:12px}
.so-ally-portrait{position:absolute;left:5px;top:5px;width:32px;height:32px;display:grid;place-items:center;color:#2c1e12;background:#b59055;border:1px solid #e5ca8d}
.so-ally-frame b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.so-ally-frame i{display:block;width:100%;height:5px;margin-top:7px;background:#b7463d;box-shadow:0 0 0 1px #24110f;font-style:normal}
.so-ally-frame small{display:block;margin-top:4px;color:#c9b899}
.so-ally-frame.down{border-color:#b7463d}
.so-ally-frame.down small{color:#e8a196}

.so-overlay button:focus-visible,.so-overlay input:focus-visible,.so-overlay select:focus-visible{outline:2px solid #f3ce74;outline-offset:3px}
@media(max-width:740px){.so-home,.so-boards,.so-choice-cards{grid-template-columns:1fr}.so-overlay{padding:14px}.so-ally-frame{top:46px;left:8px;transform:scale(.85);transform-origin:top left}}

/* Entry and mode selection. */
.so-overlay{padding-top:100px}
.so-overlay [hidden],#ss-user-nav[hidden]{display:none!important}
.so-header{align-items:center}
.so-home-boards{grid-column:1/-1;justify-self:center;margin-top:12px}
.so-auth-tabs{display:flex;gap:8px;margin-bottom:20px}
.so-auth-tabs [aria-pressed="true"]{border-color:#d9bc75;color:#f3dfad;background:#3a2b1e}
.so-panel:has(.so-auth){max-width:480px}
.so-auth .btn{width:100%;margin:14px 0 4px}
.so-guest-button{display:block;width:100%;margin:18px 0 0;background:transparent}
.so-preparation{display:flex;gap:10px;flex-wrap:wrap;margin:18px 0}
.so-hero-portrait{float:right;width:96px;height:96px;object-fit:contain;image-rendering:pixelated}
#ss-user-nav{position:fixed;z-index:1200;top:14px;right:18px;display:flex;align-items:center;gap:8px}
#ss-user-nav .btn{margin:0;min-height:38px}
#ss-user-name{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.so-join{margin-top:18px}
@media(max-width:600px){.so-overlay{padding-top:78px}.so-header h2{font-size:22px}.so-header .btn{font-size:12px;padding:8px}#ss-user-nav{top:8px;right:8px}#ss-user-nav .btn{font-size:12px;padding:7px 10px}.so-hero-portrait{width:72px;height:72px}}
#ss-user-nav svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}
.so-room:empty{display:none}
