/* Additions to the original layout; tables and glossary keep their structure. */
#dice-overlay{position:fixed;inset:0;width:100%;height:100%;z-index:20;pointer-events:none}
.die-stage{height:190px;width:220px;max-width:100%;margin:auto}
.die-stage::before{content:'F D';font:800 52px 'Segoe UI',sans-serif;color:#cab888}
.dice-ready .die-stage::before{content:none}
.roll-area{grid-template-columns:220px 1fr}
.die-wrap{display:grid;justify-items:center;gap:8px}
@media(max-width:760px){.die-wrap{width:100%;min-width:0}.die-stage{width:min(100%,380px);height:clamp(240px,72vw,280px)}}
.roll-readout{position:static;transform:none!important;min-width:80px;height:30px;border-radius:9px;font-size:1rem;display:flex;gap:6px;box-shadow:none;backdrop-filter:none;padding:0 12px}
.roll-readout .system-name{font-size:.65rem;color:var(--muted)}
.mesa-controls{margin:24px auto 0;max-width:1180px;padding:22px;text-align:left;border:1px solid #555064;border-radius:20px;background:linear-gradient(125deg,#222638,#131a29);box-shadow:0 20px 60px #0004}
.control-heading{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:20px}.control-heading h2{font-size:1.24rem;margin:5px 0}
#connection{font-size:.75rem;color:#96d9b8;border:1px solid #537363;border-radius:30px;padding:8px 12px}#connection.disconnected{color:#f0bb76;border-color:#806342}
input,textarea,select{font:inherit;color:var(--text);background:#0c1220;border:1px solid #44516b;border-radius:9px;padding:10px 12px;min-width:0;width:100%;outline-offset:3px}textarea{resize:vertical;line-height:1.4}
label{display:grid;gap:7px;font-size:.8rem;color:var(--muted)}
button:not(.roll-button){border:1px solid #46516b;border-radius:10px;padding:10px 14px;background:#232d42;color:#eef2fb;cursor:pointer;font-weight:650}
button:not(.roll-button):hover:not(:disabled){background:#34405b;border-color:#9baccd}button:disabled,select:disabled{opacity:.5;cursor:default}
button.primary{color:#16131c;background:linear-gradient(120deg,#dfb46e,#f5d398);border-color:#eec683}
.config-bar{display:grid;grid-template-columns:2fr 1fr auto auto;align-items:end;gap:12px}.config-choice select{font-weight:750;border-color:#ae9062}
.control-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;font-size:.78rem;color:var(--muted)}.control-meta>div{display:flex;gap:7px}.control-meta button{font-size:.75rem;padding:7px 9px}
.texture-heading{display:flex;align-items:center;gap:14px;margin:22px 0 10px;font-size:.8rem;font-weight:700}.texture-heading small{font-weight:400;color:var(--muted)}
.theme-list{display:grid;grid-template-columns:repeat(7,1fr);gap:7px}.theme-list .theme{padding:12px 5px;background:#0e1421;border-color:#36425b;display:grid;justify-items:center;gap:8px;font-size:.76rem}.theme-list .theme.selected{outline:2px solid #ebc57e;outline-offset:2px;background:#263047}
.theme small{display:block;font-size:.6rem;color:var(--muted);margin-top:5px;font-weight:400}.theme-orb{display:grid;place-items:center;font:bold 14px 'Segoe UI';width:46px;height:48px;clip-path:polygon(50% 0,95% 25%,88% 78%,50% 100%,10% 80%,3% 25%);background:linear-gradient(135deg,#40455a,#111520);color:#f3e8d7;box-shadow:inset 0 0 14px #0006}
.theme-durham .theme-orb{background:linear-gradient(130deg,#79edff,#164361 48%,#622d28 55%,#e87f28)}.theme-agares .theme-orb{background:repeating-linear-gradient(65deg,#50314c 0 7px,#b18c5833 8px 9px,#40213a 10px 16px)}.theme-lawin .theme-orb{background:repeating-radial-gradient(circle at 20% 20%,#675a82 0 8px,#beb0d5 9px,#56496d 10px 15px)}.theme-fiers .theme-orb{background:repeating-conic-gradient(#e6d7a7 0 12deg,#b99c5f 13deg 15deg);color:#503410}.theme-thon .theme-orb{background:repeating-linear-gradient(120deg,#51262d 0 9px,#b3837444 10px 12px,#402127 13px 22px)}.theme-eldeth .theme-orb{background:linear-gradient(135deg,#bcdfef,#284966 45%,#56819c 65%,#182f49)}
#message{color:#ebc77f;font-size:.82rem;margin-bottom:0;white-space:pre-line}#message:empty{display:none}
dialog{background:#111827;color:var(--text);border:1px solid #56647e;border-radius:20px;padding:0;box-shadow:0 30px 90px #0009}dialog::backdrop{background:#030710b8;backdrop-filter:blur(4px)}
.editor-dialog{width:min(1160px,96vw);max-height:94vh}.dialog-head{max-width:none;margin:0;padding:18px 22px;text-align:left;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #34405a}.dialog-head h2{margin:6px 0;font-size:1.5rem}
.dialog-head{position:sticky;top:0;z-index:2;background:#111827}.editor-meta{display:grid;grid-template-columns:2fr 1fr;gap:13px;padding:18px 22px}.wide{grid-column:1/-1}.editor-tabs{display:flex;align-items:center;gap:8px;padding:0 22px 14px;border-bottom:1px solid #34405a}.editor-tabs span{font-size:.78rem;color:var(--muted);margin-left:10px}.editor-tabs button.active{border-color:#efc17c;color:#efc17c}
.range-tools{display:flex;align-items:end;gap:10px;padding:13px 22px;background:#171f31}.range-tools[hidden],#rangeBounds[hidden]{display:none}.range-tools input{width:90px}.range-tools small{align-self:center;color:var(--muted)}
.editor-body{display:grid;grid-template-columns:180px 1fr;min-height:420px}.editor-body nav{padding:10px;max-height:480px;overflow:auto;border-right:1px solid #34405a}.range-item{display:grid;gap:4px;text-align:left;width:100%;margin-bottom:6px}.range-item small{font-size:.68rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}.range-item.active{border-color:#efc17c!important;background:#443b31!important}
.row-editor{padding:12px 18px}.row-editor h3{margin:6px 0 14px}.effect-edit{min-width:0;border:1px solid #43516b;border-radius:12px;padding:13px}.effect-edit legend{font-weight:800;color:#e6bd75;padding:0 5px}.effect-edit label+label{margin-top:10px}.effect-edit textarea{font-size:.85rem}#effectEditor{display:grid;grid-template-columns:1fr 1fr;gap:12px}
#rangeBounds{display:flex;flex-wrap:wrap;gap:8px;align-items:end;margin-bottom:18px}#rangeBounds input{width:90px}#rangeBounds small{flex-basis:100%;color:var(--muted);font-size:.72rem}
.dialog-foot{max-width:none;margin:0;padding:14px 22px;text-align:right;background:#192236;border-top:1px solid #34405a;position:sticky;bottom:0}.dialog-foot>div{display:flex;justify-content:flex-end;gap:8px}.dialog-foot small{display:block;margin-top:8px}#editorMessage,#loginError{color:#ffc294;white-space:pre-line;margin:0 0 10px}
.small-dialog{width:min(460px,92vw);padding:26px}.small-dialog p{font-size:.88rem;line-height:1.55;color:var(--muted)}.small-dialog h2{margin:10px 0}.small-dialog button{margin-top:15px;width:100%}
@media(max-width:1040px){.theme-list{grid-template-columns:repeat(4,1fr)}.config-bar{grid-template-columns:2fr 1fr}.control-meta{align-items:flex-start;flex-direction:column}.editor-body{grid-template-columns:145px 1fr}}
@media(max-width:760px){.mesa-controls{padding:16px}.control-heading{align-items:flex-start;flex-direction:column}.config-bar{grid-template-columns:1fr 1fr}.config-choice{grid-column:1/-1}.theme-list{grid-template-columns:repeat(3,1fr)}.texture-heading{align-items:flex-start;flex-direction:column;gap:6px}.roll-area{grid-template-columns:1fr}.editor-meta{padding:14px}.editor-body{grid-template-columns:100px 1fr}.editor-body nav{padding:6px}.row-editor{padding:10px}#effectEditor{grid-template-columns:1fr}.editor-tabs{padding:10px;flex-wrap:wrap}.editor-tabs span{display:none}.range-tools{padding:10px;flex-wrap:wrap}.dialog-head{padding:12px}.dialog-head h2{font-size:1.1rem}.dialog-foot{padding:10px}.dialog-foot>div{flex-wrap:wrap}.dialog-foot button{font-size:.78rem;padding:8px}.effect-edit{padding:8px}.editor-dialog{max-height:96vh}.range-item{padding:8px!important}.control-meta>div{flex-wrap:wrap}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
[hidden]{display:none!important}
.theme-picker{position:relative;width:340px;max-width:100%;z-index:30}
#themeTrigger{width:100%;display:grid;grid-template-columns:46px 1fr 24px;align-items:center;gap:12px;text-align:left;padding:9px 13px;background:#0c1423;border-color:#75839e}
#themeTrigger .theme-orb{width:40px;height:42px}#themeTrigger small{font-size:.72rem}
#themeTrigger[aria-expanded=true]{border-color:#eac582;box-shadow:0 0 0 2px #eac58225}
.theme-chevron{text-align:center;font-size:1.5rem;color:#d9c39e}
#themeList{display:block;position:absolute;left:0;right:0;top:calc(100% + 7px);max-height:350px;overflow-y:auto;padding:6px;background:#101a2a;border:1px solid #75839e;border-radius:13px;box-shadow:0 20px 45px #000a;overscroll-behavior:contain}
#themeList .theme{width:100%;display:grid;grid-template-columns:42px 1fr 22px;justify-items:start;align-items:center;gap:10px;padding:8px 10px;text-align:left;margin:0;border:1px solid transparent;border-radius:8px;background:transparent;font-size:.83rem}
#themeList .theme-orb{width:34px;height:36px}#themeList .theme small{font-size:.68rem}
#themeList .theme.selected{outline:none;border-color:#eac58266;background:#3f3829}
#themeList .theme:focus-visible{outline:2px solid #a2c9ff;outline-offset:-2px;background:#283a53}
.theme-check{color:#eac582;font-size:1.1rem}
.history-time{display:block;color:#b4bfd4;font-size:.75rem;margin:-2px 0 11px;font-variant-numeric:tabular-nums}
#currentKey{font-family:Consolas,monospace;font-size:.82rem}#keyMessage{overflow-wrap:anywhere;color:#eac582}
