:root {
  --ink: #3a2208;
  --sand: #e8cf9a;
  --gold: #f6d777;
  --gold-dk: #9c7a22;
  --lapis: #1d4d6b;
  --font: "Myriad Pro", "Myriad", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #0d0904; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; overscroll-behavior: none; font-family: var(--font); color: #fff;
}
#viewport {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #0d0904 url(../assets/tex/menus/menubg_tile.png) repeat; background-size: 256px;
}
#viewport::before { content: ""; position: absolute; inset: 0; background: rgba(8, 5, 0, .78); }
#stage { position: relative; width: 320px; height: 480px; overflow: hidden; flex: none; transform-origin: center center; background: #1d1206; box-shadow: 0 0 40px #000; }
img { -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; }

#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at 50% 40%, #6b4a1c 0%, #1d1206 72%); }
.loading-title { font-size: 30px; font-weight: 700; letter-spacing: 2px; color: var(--gold); text-shadow: 0 2px 0 #000; font-variant: small-caps; }
.loading-bar { width: 200px; height: 8px; border-radius: 4px; background: #000; border: 1px solid var(--gold-dk); overflow: hidden; }
#loading-fill { height: 100%; width: 0; background: linear-gradient(#ffe9a0, #c99a2a); transition: width .2s; }
#loading-text { font-size: 13px; color: #d8c49a; }

.screen { position: absolute; inset: 0; overflow: hidden; }
.hidden { display: none !important; }
.bm { display: inline-block; position: relative; white-space: nowrap; line-height: 0; vertical-align: middle; }
.bm > i { position: absolute; display: block; background-repeat: no-repeat; }

/* ---------- menus ---------- */
.menu-bg { background: url(../assets/tex/menus/menubg_tile.png) repeat; background-size: 256px; }
.menu-bg::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 50px rgba(60, 30, 0, .55); }
.menu-header { position: absolute; left: 0; right: 0; top: 0; height: 58px; z-index: 3; background: url(../assets/tex/menus/menubg_header.png) center/320px 58px no-repeat;
  display: flex; align-items: center; justify-content: center; padding-bottom: 6px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.menu-side { position: absolute; top: 52px; bottom: 74px; width: 16px; z-index: 2; background-size: 32px 128px; background-repeat: repeat-y; pointer-events: none; }
.menu-side.l { left: 0; background-image: url(../assets/tex/menus/menubg_left.png); background-position: right top; }
.menu-side.r { right: 0; background-image: url(../assets/tex/menus/menubg_right.png); background-position: left top; }
.menu-body { position: absolute; left: 0; right: 0; top: 56px; bottom: 74px; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; z-index: 1; padding: 0 14px; }
.subline { text-align: center; font-size: 12.5px; color: var(--ink); padding: 8px 6px 2px; font-weight: 600; }

.bottombar { position: absolute; left: 0; right: 0; bottom: 0; height: 78px; z-index: 4; background: linear-gradient(#20385a, #0b1624);
  border-top: 3px solid #c9a649; display: flex; justify-content: space-around; align-items: flex-start; padding-top: 3px; }
.bottombar button { all: unset; width: 62px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.bottombar button img { width: 50px; height: 52px; display: block; }
.bottombar button span { font-size: 10px; font-weight: 700; color: #d8c48f; margin-top: 1px; text-shadow: 0 1px 0 #000; }
.bottombar button.active span { color: #ffe28a; }

.imgbtn { all: unset; position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background-size: 100% 100%; background-repeat: no-repeat; color: #fff; font-weight: 700; text-align: center; }
.imgbtn:active { filter: brightness(1.15); transform: translateY(1px); }
.imgbtn.disabled { filter: grayscale(.8) brightness(.6); pointer-events: none; }
.games-btn { width: 210px; height: 84px; margin: 3px auto; background-image: url(../assets/tex/menus/games_button.png); font-size: 19px; color: #f8eccb; text-shadow: 0 1px 2px #000; }
.games-btn:active { background-image: url(../assets/tex/menus/games_button_active.png); }
.games-btn small { display: block; font-size: 11px; font-weight: 400; margin-top: 1px; color: #e6d6a8; }
.games-wrap { position: relative; width: 304px; height: 319px; margin: 10px auto 0; background: url(../assets/tex/menus/games_overlay.png) center/304px 319px no-repeat;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 34px; }
.blue-btn { height: 44px; min-width: 120px; padding: 0 16px; background-image: url(../assets/tex/menus/results_button.png); font-size: 14px; color: #f8eccb; text-shadow: 0 1px 2px #000; }
.blue-btn:active { background-image: url(../assets/tex/menus/results_button_active.png); }
.blue-btn.disabled { background-image: url(../assets/tex/menus/results_button_locked.png); }

.paper { position: relative; margin: 8px 0; padding: 10px 12px; color: var(--ink);
  background: url(../assets/tex/menus/widescroll_tile.png) center top / 100% 256px repeat-y; border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.45), inset 0 0 18px rgba(120, 70, 20, .3); font-size: 12.5px; line-height: 1.35; }
.paper h3 { margin: 0 0 4px; font-size: 14px; color: #6b2b0b; }
.paper table { width: 100%; border-collapse: collapse; font-size: 12px; }
.paper td, .paper th { padding: 1px 2px; text-align: left; }
.paper th { color: #6b2b0b; font-size: 11px; border-bottom: 1px solid rgba(80,40,10,.35); }
.paper .num { text-align: right; font-variant-numeric: tabular-nums; }
.paper .row { display: flex; justify-content: space-between; gap: 6px; }
.paper .row b { font-weight: 600; text-align: right; }

/* dice grid */
.dice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 2px; padding: 6px 0 12px; }
.dice-cell { position: relative; height: 112px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.dice-cell .plate { position: relative; width: 87px; height: 92px; background: url(../assets/tex/menus/mydice_plate_off.png) center/100% 100% no-repeat; }
.dice-cell.sel .plate { background-image: url(../assets/tex/menus/mydice_plate_on.png); }
.dice-cell .plate img { position: absolute; left: 14px; top: 15px; width: 59px; height: 59px; }
.dice-cell.locked .plate img { filter: grayscale(1) brightness(.35); }
.dice-cell .name { font-size: 11px; font-weight: 700; color: var(--ink); text-align: center; line-height: 12px; margin-top: 1px; }
.dice-cell.locked .name { color: #8a6c40; }

/* treasures */
.gem-plaque { position: relative; width: 196px; height: 77px; margin: 6px auto 0; background: url(../assets/tex/menus/gems_plaque_gold.png) center/100% 100% no-repeat;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #3c2503; }
.gem-plaque.steel { background-image: url(../assets/tex/menus/gems_plaque_steel.png); }
.gem-plaque .big { font-size: 24px; font-weight: 700; }
.gem-plaque .small { font-size: 11px; font-weight: 600; }
.gem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 0; padding: 8px 0 6px; justify-items: center; }
.gem { width: 66px; height: 66px; background-size: contain; background-repeat: no-repeat; background-position: center; cursor: pointer; position: relative; margin-bottom: 14px; }
.gem span { position: absolute; bottom: -13px; left: -8px; right: -8px; text-align: center; font-size: 9px; font-weight: 700; color: var(--ink); line-height: 10px; }
.section-head { display: flex; justify-content: center; margin: 10px 0 2px; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; height: 50px; margin: 4px 0; padding: 0 14px;
  background: url(../assets/tex/menus/settings_woodbar.png) center/100% 100% no-repeat; }
.set-row label { font-size: 15px; font-weight: 700; color: #f6e2b8; text-shadow: 0 1px 0 #000; }
.toggle { display: flex; gap: 2px; }
.toggle button { all: unset; width: 50px; height: 30px; background: url(../assets/tex/menus/settings_radiobutton_off.png) center/100% 100%; color: #fff; font-weight: 700; font-size: 12px; text-align: center; line-height: 30px; cursor: pointer; text-shadow: 0 1px 1px #000; }
.toggle button.on { background-image: url(../assets/tex/menus/settings_radiobutton_on.png); }
.toggle button:not(.on) { filter: grayscale(.7) brightness(.6); }
.btn-col { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; }

/* map of Egypt */
.map-scroll { position: absolute; left: 0; right: 0; top: 56px; bottom: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.map { position: relative; width: 320px; height: 1066px; background: url(../assets/tex/menus/map.jpg) top/320px 1066px no-repeat; }
.map-hint { position: sticky; top: 0; z-index: 2; text-align: center; font-size: 12px; font-weight: 700; color: #4a2a08; background: rgba(240, 220, 170, .85); padding: 3px; }
.marker { position: absolute; width: 47px; height: 46px; cursor: pointer; }
.marker img { width: 47px; height: 46px; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.marker.cur img { filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(0 0 2px #fff); }
.marker .lbl { position: absolute; top: 2px; white-space: nowrap; font-size: 11px; font-weight: 700; color: #3a1d02; text-shadow: 0 0 3px #f8e8c0, 0 0 3px #f8e8c0; line-height: 13px; }
.marker.right .lbl { left: 50px; text-align: left; }
.marker.left .lbl { right: 50px; text-align: right; }
.marker .lbl small { font-weight: 600; font-size: 10px; display: block; }
.marker.locked .lbl { color: #6b5636; }

/* temple door intro */
.intro { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.door { position: relative; width: 241px; height: 386px; perspective: 900px; }
.door .leaf { position: absolute; top: 0; width: 50%; height: 100%; background-size: 241px 386px; background-repeat: no-repeat; transition: transform 1.1s ease-in; transform-style: preserve-3d; box-shadow: 0 6px 16px rgba(0,0,0,.6); }
.door .leaf.l { left: 0; background-position: left top; transform-origin: left center; }
.door .leaf.r { right: 0; background-position: right top; transform-origin: right center; }
.door.open .leaf.l { transform: rotateY(-100deg); }
.door.open .leaf.r { transform: rotateY(100deg); }
.intro .info { text-align: center; color: var(--ink); font-size: 13px; font-weight: 700; }

/* ---------- popups ---------- */
.modal { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); animation: fadein .18s ease-out; }
@keyframes fadein { from { opacity: 0 } }
.scrollpop { position: relative; width: 296px; animation: unroll .28s ease-out; transform-origin: top center; }
@keyframes unroll { from { transform: scaleY(.2); opacity: .2 } }
.scrollpop .rod { height: 28px; background: url(../assets/tex/menus/widescroll_end.png) center/300px 51px no-repeat; margin: 0 -2px; position: relative; z-index: 2; }
.scrollpop .body { margin: -10px 8px; padding: 14px 14px 12px; background: url(../assets/tex/menus/widescroll_tile.png) center top / 100% 256px repeat-y; color: var(--ink);
  box-shadow: inset 0 0 22px rgba(110, 60, 15, .4); font-size: 13px; line-height: 1.4; max-height: 70vh; overflow-y: auto; }
.scrollpop .head { display: flex; justify-content: center; margin-bottom: 6px; }
.scrollpop .icon { display: block; margin: 0 auto 6px; max-width: 72px; max-height: 72px; }
.scrollpop .btns { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.scrollpop p { margin: 0 0 8px; }
.scrollpop h4 { margin: 6px 0 2px; color: #6b2b0b; }
.scrollpop .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: 3px; text-align: center; font-weight: 700; color: #6b2b0b; margin: 6px 0; user-select: text; -webkit-user-select: text; }
.scrollpop input { width: 100%; padding: 8px; font-size: 16px; border: 1px solid #8a5a22; border-radius: 4px; background: #fff8e6; color: var(--ink); }
.scrollpop input.passkey { text-align: center; text-transform: uppercase; letter-spacing: 2px; }
.scrollpop table { width: 100%; font-size: 12px; border-collapse: collapse; }
.scrollpop td:last-child { text-align: right; }

/* ---------- table ---------- */
.table-screen { background: #000; }
.table-art { position: absolute; left: 0; width: 320px; height: 480px; }
.table-art > .layer { position: absolute; left: 0; width: 320px; background-repeat: no-repeat; background-size: 100% 100%; }
.tb-btn { all: unset; position: absolute; top: 4px; width: 57px; height: 28px; background-size: 100% 100%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fbe9bf; text-shadow: 0 1px 1px #000; cursor: pointer; z-index: 6; }
.tb-btn:active { filter: brightness(1.3); }
.tb-btn.left { left: 4px; } .tb-btn.right { right: 4px; }
.tb-title { position: absolute; left: 64px; right: 64px; top: 2px; height: 34px; display: flex; align-items: center; justify-content: center; z-index: 5; pointer-events: none; }
.portrait { position: absolute; left: 7px; top: 43px; width: 64px; height: 61px; z-index: 5; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.god-dice { position: absolute; left: 80px; top: 45px; width: 234px; height: 58px; z-index: 5; display: flex; justify-content: center; align-items: center; gap: 5px; }
.ddie { width: 40px; height: 54px; background-repeat: no-repeat; background-size: 400px 64px; background-position-y: -5px; position: relative; }
.ddie.empty { background-image: none !important; background: rgba(0,0,0,.35); border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255,230,160,.25); }
.ddie.held::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: -3px; height: 3px; background: #ffd34d; border-radius: 2px; box-shadow: 0 0 4px #ffd34d; }
.god-label { position: absolute; left: 80px; right: 6px; top: 92px; z-index: 6; text-align: center; font-size: 10.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; pointer-events: none; }

.tray { position: absolute; left: 0; width: 320px; height: 480px; perspective: 760px; perspective-origin: 160px 240px; transform-style: preserve-3d; z-index: 2; }
.die { position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; transform-style: preserve-3d; will-change: transform; pointer-events: none; }
.die .f { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background-repeat: no-repeat; border-radius: 6px; overflow: hidden; }
.die.round .f { border-radius: 14px; }
.die.casino .f { border-radius: 2px; }
.die .f i { position: absolute; inset: 0; background: #000; opacity: 0; display: block; border-radius: inherit; }
.dshadow { position: absolute; left: 0; top: 0; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 12px; background: rgba(0,0,0,.55); filter: blur(4px); will-change: transform, opacity; pointer-events: none; }

.status { position: absolute; left: 0; right: 0; top: 116px; z-index: 5; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.status .round { padding: 2px 12px; border-radius: 10px; background: rgba(0,0,0,.55); font-size: 12px; font-weight: 700; color: #ffe8a8; }
.status .phand { margin-top: 3px; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 6px #000; min-height: 16px; }
.announce { position: absolute; left: 0; right: 0; top: 200px; z-index: 8; display: flex; justify-content: center; pointer-events: none; animation: announce 1.6s ease-out forwards; }
@keyframes announce { 0% { transform: scale(.4); opacity: 0 } 15% { transform: scale(1.08); opacity: 1 } 25% { transform: scale(1) } 80% { opacity: 1 } 100% { opacity: 0 } }
.hint { position: absolute; left: 20px; right: 20px; top: 330px; z-index: 5; text-align: center; font-size: 13px; font-weight: 700; color: #fff; pointer-events: none;
  text-shadow: 0 1px 2px #000, 0 0 8px #000; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45 } }
.roll-btn { all: unset; position: absolute; left: 6px; top: 406px; width: 49px; height: 45px; z-index: 7; background-size: 100% 100%; cursor: pointer; }
.roll-btn.off { filter: grayscale(.9) brightness(.55); pointer-events: none; }
.roll-btn span { position: absolute; left: -2px; right: -2px; bottom: -14px; text-align: center; font-size: 10.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 1px #000; }
.coinbar { position: absolute; left: 60px; right: 6px; top: 459px; height: 19px; z-index: 6; display: flex; align-items: center; justify-content: center; gap: 4px; pointer-events: none;
  font-weight: 700; font-size: 13px; color: #ffe28a; text-shadow: 0 1px 1px #000; font-variant-numeric: tabular-nums; }
.coinbar img { width: 11px; height: 14px; }
.lucky-chip { position: absolute; right: 8px; top: 116px; z-index: 6; display: flex; align-items: center; gap: 4px; padding: 2px 6px 2px 4px; border-radius: 10px; background: rgba(0,0,0,.55);
  font-size: 10.5px; font-weight: 700; color: #ffe28a; pointer-events: none; }
.lucky-chip i { width: 16px; height: 22px; background-size: 160px 26px; background-repeat: no-repeat; background-position-y: -2px; display: block; }
.action-row { position: absolute; left: 0; right: 0; z-index: 7; display: flex; justify-content: center; gap: 10px; }
.act-btn { all: unset; height: 40px; min-width: 104px; padding: 0 12px; background: url(../assets/tex/menus/results_button.png) center/100% 100% no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #f8eccb; text-shadow: 0 1px 2px #000; cursor: pointer; }
.act-btn:active { background-image: url(../assets/tex/menus/results_button_active.png); }
.act-btn.disabled { background-image: url(../assets/tex/menus/results_button_locked.png); color: #999; pointer-events: none; }
.extra { position: absolute; left: 0; right: 0; z-index: 3; background: url(../assets/tex/menus/menubg_tile.png) repeat; background-size: 256px; }
.extra::after { content: ""; position: absolute; inset: 0; background: rgba(20,10,0,.55); pointer-events: none; }
.extra > * { position: relative; z-index: 1; }

/* pregame / results panel over the box */
.panel { position: absolute; left: 0; width: 320px; height: 289px; z-index: 20; background-size: 320px 289px; animation: drop .25s ease-out; }
@keyframes drop { from { transform: translateY(-14px); opacity: 0 } }
.panel .inner { position: absolute; left: 26px; right: 26px; top: 18px; bottom: 16px; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--ink); }
.panel.dark .inner { color: #fff; }
.panel .sub { font-size: 13px; font-weight: 700; margin-top: 2px; }
.panel .msg { font-size: 12px; margin-top: 3px; }
.panel .warn { font-size: 14px; color: #b3260e; font-weight: 700; margin-top: 4px; }
.panel .grow { flex: 1; }
.panel .btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.panel .t-portrait { width: 64px; height: 61px; box-shadow: 0 2px 6px rgba(0,0,0,.5); margin-top: 4px; }
.res-hands { width: 100%; font-size: 12px; margin-top: 4px; font-weight: 600; }
.res-hands .row, .bonus-list .row { display: flex; justify-content: space-between; padding: 1px 2px; }
.bonus-list { width: 100%; margin-top: 4px; font-size: 12px; border-top: 1px solid rgba(80,40,10,.35); padding-top: 3px; min-height: 30px; }
.panel.dark .bonus-list { border-color: rgba(255,230,160,.35); }
.bonus-list .row { animation: fadein .25s both; }
.bonus-list .row b { color: #7a3d00; }
.panel.dark .bonus-list .row b { color: #ffe28a; }
.bonus-list .total { border-top: 1px solid rgba(80,40,10,.4); margin-top: 2px; padding-top: 2px; font-weight: 700; }
.float-plus { position: absolute; z-index: 30; font-weight: 800; color: #ffe066; font-size: 18px; text-shadow: 0 1px 2px #000; pointer-events: none; animation: floatup 1.1s ease-out forwards; }
@keyframes floatup { to { transform: translateY(-40px); opacity: 0 } }

/* blitz */
.blitz-clock { position: absolute; left: 80px; top: 44px; width: 234px; height: 60px; z-index: 6; display: flex; align-items: center; justify-content: space-around; pointer-events: none; }
.blitz-clock .v { display: flex; flex-direction: column; align-items: center; font-size: 10px; font-weight: 700; color: #f0dfb0; text-shadow: 0 1px 1px #000; }
.blitz-clock .v b { font-size: 20px; color: #fff; font-variant-numeric: tabular-nums; }
.blitz-clock .v.low b { color: #ff7d6a; }
.blitz-list .row { display: flex; justify-content: space-between; align-items: center; padding: 5px 4px; border-bottom: 1px solid rgba(80,40,10,.25); cursor: pointer; }
.blitz-list .row.locked { opacity: .5; cursor: default; }
.blitz-list img { width: 40px; height: 38px; margin-right: 8px; }

.toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; background: rgba(0,0,0,.8); color: #fff; padding: 6px 12px; border-radius: 14px; font-size: 12px; white-space: nowrap; animation: fadein .2s; }
.kbd-hint { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 10px; color: #c9b07a; z-index: 3; }

/* ================= controller ================= */
.pad-focus { outline: 2px solid #ffd84d !important; outline-offset: 2px; box-shadow: 0 0 12px 2px rgba(255, 216, 77, .75) !important; border-radius: 6px; }
.marker.pad-focus { outline: none !important; box-shadow: none !important; }
.marker.pad-focus img { filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(0 0 3px #fff) brightness(1.15); }
body:not(.pad) .pad-only { display: none !important; }
body.pad .kbd-only { display: none !important; }
.pad-glyph { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; vertical-align: middle;
  font-size: 9px; font-weight: 800; line-height: 1; color: #fff; background: #4a4a4a; box-shadow: inset 0 -1px 0 rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.35); }
.pad-glyph.a { background: #3c9a2e; } .pad-glyph.b { background: #c0392b; } .pad-glyph.x { background: #2c6fc9; } .pad-glyph.y { background: #d4a017; color: #2a1a00; }
.pad-glyph.lb, .pad-glyph.rb, .pad-glyph.menu, .pad-glyph.view { border-radius: 3px; }
body.pad .die.cursor .f::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px #ffd84d, inset 0 0 10px rgba(255, 216, 77, .9); }
body.pad .dshadow.cursor { background: rgba(255, 205, 60, .95); }
.pad-legend { position: absolute; left: 0; right: 0; bottom: 3px; z-index: 7; display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 9px; pointer-events: none;
  font-size: 10px; font-weight: 700; color: #f0dfb0; text-shadow: 0 1px 1px #000; }
.pad-legend b { font-weight: 800; }

/* ================= widescreen ================= */
/* table: god panel | 320x480 table between pillars | player panel */
.side { position: absolute; top: 0; bottom: 0; display: none; z-index: 4; overflow: hidden; background: url(../assets/tex/menus/menubg_tile.png) repeat; background-size: 256px; }
.side::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(20,10,0,.25), rgba(12,6,0,.7)); pointer-events: none; }
.landscape .side { display: block; }
.side.l { left: 0; } .side.r { right: 0; }
.pillar { position: absolute; top: 0; bottom: 0; width: 46px; z-index: 2; background: url(../assets/tex/menus/temple_left.png) center / 100% 100% no-repeat; filter: drop-shadow(0 0 8px rgba(0,0,0,.7)); }
.side.l .pillar { right: 0; }
.side.r .pillar { left: 0; background-image: url(../assets/tex/menus/temple_right.png); }
.side-col { position: absolute; top: 0; bottom: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 14px 12px; }
.side.l .side-col { left: 0; right: 46px; } .side.r .side-col { left: 46px; right: 0; }
.side-title { min-height: 30px; display: flex; align-items: center; filter: drop-shadow(0 2px 2px #000); }
.side-card { width: 100%; max-width: 220px; padding: 12px 10px; text-align: center; color: var(--ink); border-radius: 3px;
  background: url(../assets/tex/menus/widescroll_tile.png) center top / 100% 256px repeat-y; box-shadow: 0 3px 10px rgba(0,0,0,.6), inset 0 0 18px rgba(120, 70, 20, .3); }
.side-portrait { display: block; width: min(128px, 100%); height: auto; aspect-ratio: 64 / 61; margin: 0 auto 8px; box-shadow: 0 0 0 2px #6b4a1c, 0 3px 8px rgba(0,0,0,.6); }
.side-name { display: flex; justify-content: center; min-height: 24px; }
.side-hand { margin-top: 3px; min-height: 19px; font-size: 15px; font-weight: 700; color: #6b2b0b; }
.side-label { margin-top: 8px; font-size: 11px; font-weight: 600; color: #6b4a1c; text-transform: uppercase; letter-spacing: .5px; }
.side-round { padding: 3px 14px; border-radius: 12px; background: rgba(0,0,0,.6); box-shadow: 0 0 0 1px rgba(255,230,160,.25); font-size: 14px; font-weight: 700; color: #ffe8a8; text-align: center; }
.side-coins { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 22px; font-weight: 800; color: #5a3000; font-variant-numeric: tabular-nums; }
.side-coins img { width: 16px; height: 20px; }
.side-lucky { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 700; color: #6b2b0b; }
.side-lucky i { display: block; width: 40px; height: 54px; background-size: 400px 64px; background-repeat: no-repeat; }
.side-actions .action-row { position: static; flex-direction: column; align-items: center; gap: 8px; }
.side-actions .act-btn { min-width: 150px; }
.side-legend { max-width: 230px; text-align: center; font-size: 10.5px; line-height: 2; color: #e8d4a0; text-shadow: 0 1px 1px #000; }
.side-legend span { display: inline-block; margin: 0 5px; white-space: nowrap; }
.side-legend b { color: #fff; }
.landscape .status, .landscape .lucky-chip, .landscape .god-label, .landscape .pad-legend { display: none; }

/* menus: header across the full width (9-slice), tab bar becomes a rail on the left */
.landscape .menu-header { background: none; border-style: solid; border-color: transparent; border-width: 7px 9px; border-image: url(../assets/tex/menus/menubg_header.png) 12% 2.8% fill / 7px 9px stretch; padding-bottom: 0; }
.landscape .main-menu .bottombar { top: 56px; bottom: 0; right: auto; width: 86px; height: auto; flex-direction: column; justify-content: space-evenly; align-items: center; padding: 0;
  border-top: 0; border-right: 3px solid #c9a649; background: linear-gradient(90deg, #20385a, #0b1624); }
.landscape .main-menu .menu-side { bottom: 0; }
.landscape .main-menu .menu-side.l { left: 86px; }
.landscape .menu-body { padding: 0 30px 14px; }
.landscape .main-menu .menu-body { left: 86px; bottom: 0; }
.landscape .dice-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.landscape .gem-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.landscape .menu-body[data-tab="stats"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 14px; align-content: start; align-items: start; }
.landscape .menu-body[data-tab="settings"] > * { max-width: 440px; margin-left: auto; margin-right: auto; }
.landscape .menu-body[data-tab="settings"] > .set-row { margin-top: 4px; margin-bottom: 4px; }
.games-row { display: contents; }
.games-summary { display: none; }
.landscape .games-row { display: flex; justify-content: center; align-items: center; gap: 28px; min-height: calc(100% - 30px); }
.landscape .games-row .games-wrap { margin: 0; flex: none; }
.landscape .games-summary { display: block; width: 250px; flex: none; }
.landscape .blitz-list { max-width: 580px; margin: 8px auto; }
.set-row label small { font-size: 11px; font-weight: 600; color: #e6d6a8; }
.toggle.four button { width: 42px; }

/* map: the map on the left, details of the focused temple on the right */
.map-info { display: none; }
.landscape .map-scroll { left: 24px; right: auto; width: 338px; }
.landscape .map-info { position: absolute; top: 58px; bottom: 0; left: 380px; right: 0; display: flex; align-items: center; justify-content: center; padding: 10px 24px; }
.map-info .paper { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; max-width: 470px; padding: 14px 16px; }
.map-door { width: 140px; height: 224px; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.55); }
.map-info-text { flex: 1 1 170px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.map-info-text .row.warn { color: #b3260e; font-weight: 700; }

/* temple door: door on the left, bet and Enter on the right */
.intro-side { display: contents; }
.landscape .intro { display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center; column-gap: 44px; row-gap: 10px; }
.landscape .intro > .bm { grid-column: 1 / 3; justify-self: center; }
.landscape .intro-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }

/* ================= web: access code, offline / install guide (outside the scaled stage) ================= */
#gate { position: fixed; inset: 0; z-index: 1000; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #1d1206 url(../assets/tex/menus/menubg_tile.png) repeat; background-size: 256px;
  -webkit-user-select: text; user-select: text; touch-action: pan-y; font-size: 16px; line-height: 1.45; color: var(--ink); }
#gate::before { content: ""; position: fixed; inset: 0; background: rgba(20, 10, 0, .55); pointer-events: none; }
.gate-card { position: relative; max-width: 620px; margin: 0 auto; padding: 22px 20px 20px; border-radius: 6px;
  background: url(../assets/tex/menus/widescroll_tile.png) center top / 100% 256px repeat-y; box-shadow: 0 6px 30px rgba(0,0,0,.6), inset 0 0 26px rgba(120, 70, 20, .35); }
.gate-logo { text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 2px; font-variant: small-caps; color: #6b2b0b; margin-bottom: 6px; }
.gate-lead { margin: 6px 0 14px; text-align: center; font-size: 17px; font-weight: 600; }
.gate-small { margin: 6px 0; font-size: 14.5px; }
.gate-foot { margin-top: 18px; text-align: center; opacity: .8; }
.gate-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 0 auto; }
.gate-input { width: 100%; padding: 14px; font-size: 20px; text-align: center; letter-spacing: 1px; border: 2px solid #8a5a22; border-radius: 8px; background: #fff8e6; color: var(--ink); }
.gate-input:focus { outline: 3px solid #f6d777; }
.gate-show { font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.gate-show input { width: 20px; height: 20px; }
.gate-error { min-height: 20px; color: #b3260e; font-weight: 700; font-size: 15px; text-align: center; }
.gate-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 10px 18px; border: 0; border-radius: 10px; cursor: pointer;
  font: 700 17px var(--font); color: #fff; background: linear-gradient(#2f6a93, #164260); box-shadow: 0 0 0 2px #c9a649, 0 3px 6px rgba(0,0,0,.4); text-shadow: 0 1px 1px #000; }
.gate-btn:active { transform: translateY(1px); filter: brightness(1.1); }
.gate-btn.primary { background: linear-gradient(#e0a92e, #a5700f); color: #fff; font-size: 19px; }
.gate-btn.install { background: linear-gradient(#3fa34d, #23702d); }
.gate-btn.hidden, .gate-bar.hidden { display: none; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.gate-actions .gate-btn { flex: 1 1 220px; }
.gate-statusbox { margin: 4px 0 6px; padding: 12px 14px; border-radius: 8px; font-size: 15.5px; text-align: center; background: rgba(255,255,255,.45); box-shadow: inset 0 0 0 2px rgba(120,70,20,.35); }
.gate-statusbox.ready { background: rgba(70, 160, 70, .22); box-shadow: inset 0 0 0 2px rgba(40, 120, 40, .6); }
.gate-statusbox.failed, .gate-statusbox.unsupported { background: rgba(200, 60, 30, .15); box-shadow: inset 0 0 0 2px rgba(180, 50, 20, .6); }
.gate-bar { height: 10px; margin-top: 8px; border-radius: 5px; background: rgba(0,0,0,.2); overflow: hidden; }
.gate-bar i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe9a0, #c99a2a); transition: width .3s; }
.gate-section { margin-top: 20px; padding-top: 14px; border-top: 2px solid rgba(110, 60, 15, .35); }
.gate-section h2 { margin: 0 0 4px; font-size: 20px; color: #6b2b0b; }
.gate-tabs { display: flex; gap: 6px; margin: 12px 0 6px; }
.gate-tab { flex: 1; min-height: 44px; border: 2px solid #8a5a22; border-radius: 8px; background: rgba(255,248,230,.6); font: 700 15px var(--font); color: var(--ink); cursor: pointer; }
.gate-tab.on { background: #6b2b0b; color: #ffe8a8; border-color: #6b2b0b; }
.gate-steps { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: step; }
.gate-steps li { position: relative; margin: 0 0 12px; padding: 2px 0 0 44px; min-height: 34px; counter-increment: step; }
.gate-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #6b2b0b; color: #ffe8a8; font-weight: 800; }
.gate-step-title { font-size: 16.5px; font-weight: 600; }
.gate-step-text { font-size: 14.5px; opacity: .9; }
.gate-icon { display: inline-block; min-width: 22px; padding: 0 4px; border-radius: 5px; background: rgba(0,0,0,.12); text-align: center; font-weight: 800; }
/* touch devices without mouse: no keyboard hints */
@media (hover: none) and (pointer: coarse) { .kbd-only { display: none !important; } }
