:root { color-scheme: dark; font-family: "Segoe UI", sans-serif; color: #f8f1dc; background: #0c1115; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: 28px; background: radial-gradient(ellipse at 25% 20%, #27313a 0, #121b23 48%, #080c10 100%); }
button, select { font: inherit; }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid #f5d78d; outline-offset: -4px; }
button { touch-action: manipulation; }
.game { width: min(720px, 100%); aspect-ratio: 13 / 6; container-type: inline-size; display: grid; grid-template-rows: 15% 66% 19%; position: relative; overflow: hidden; border-radius: 18px; background: #172126; box-shadow: 0 0 0 1px #52606b, 0 0 0 7px #0b1014, 0 16px 64px #0009; font-size: 13px; }
.icon { width: 2.9em; height: 2.9em; flex: 0 0 auto; overflow: visible; filter: drop-shadow(0 2px 2px #0009); }
.art-icon { display: inline-block; background-repeat: no-repeat; filter: url('#icon-cutout') drop-shadow(0 1px 1px #0008); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1.4%; padding: .65% 2.4% .5% 2%; z-index: 2; background: #20272b none 26.667% 38.764% / 2039.024% 1845.098% no-repeat; border-bottom: 1px solid #b49447; }
.profile { display: flex; align-items: center; width: 40%; height: 100%; gap: 3.5%; border: 0; background: none; padding: 0; text-align: left; }
.portrait { display: block; flex: 0 0 auto; width: calc(6 * var(--ui-unit)); height: calc(6.2 * var(--ui-unit)); margin-top: 0; border-radius: 50%; background: #31281f none 4.855% 40.30% / 1944.186% 1045.556% no-repeat; border: 0; box-shadow: 0 2px 5px #0008; }
.profile-info { flex: 1; min-width: 0; }
.profile-info > strong { font-size: 1.33em; font-weight: 400; display: block; margin-bottom: .25em; }
.progress-row { display: flex; align-items: center; }
.level { border-radius: 50%; border: 1px solid #c9a65b; background: linear-gradient(#65542e,#322719); width: 2.05em; height: 2.05em; display: grid; place-items: center; font-size: 1.02em; flex-shrink: 0; box-shadow: 0 2px 3px #0008; z-index: 1; }
.xp { position: relative; height: 1.62em; width: 100%; border: 1px solid #b59550; border-radius: 0 20px 20px 0; margin-left: -.5em; overflow: hidden; background: linear-gradient(#282820, #111918); }
.xp-fill { position: absolute; inset: 2px auto 2px 0; width: 49.8%; background: linear-gradient(#82be70,#488340); border-radius: 0 12px 12px 0; }
.xp-value { position: absolute; inset: 0; display: grid; place-items: center; font-size: .93em; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000; padding-left: .45em; white-space: nowrap; }
.resources { display: flex; align-items: center; gap: calc(.6 * var(--ui-unit)); }
.currency { display: flex; align-items: center; gap: .5em; padding: 0 calc(1 * var(--ui-unit)) 0 calc(.4 * var(--ui-unit)); font-size: 1.12em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.currency + .currency { border-left: 1px solid #7d85722c; }
.coins { width: 1.65em; height: 1.65em; border-radius: 50%; }
.ruby { width: 1.42em; height: 1.55em; }
.top-action { display: grid; place-items: center; padding: 0 calc(.3 * var(--ui-unit)) 0 calc(.9 * var(--ui-unit)); height: 3.2em; min-width: 3.2em; border: 0; border-left: 1px solid #7d85722c; background: none; }
.top-action .icon { width: 2.25em; height: 2.25em; }
.top-action:hover { background: #e7c7790c; }
.scene { display: grid; grid-template-columns: 25% 58% 17%; align-items: center; background: #c9b99a; position: relative; min-height: 0; }
.activity-panel { align-self: end; width: 100%; margin-bottom: calc(1.1 * var(--ui-unit)); position: relative; isolation: isolate; background: none; }
.activity-panel::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 80%; border-radius: 0; background: linear-gradient(to right, #142025e8 0%, #172428dc 84%, transparent 100%); pointer-events: none; z-index: -1; }
.activity { display: flex; align-items: center; gap: calc(.6 * var(--ui-unit)); min-height: calc(6.1 * var(--ui-unit)); padding: calc(.48 * var(--ui-unit)) calc(2 * var(--ui-unit)) calc(.48 * var(--ui-unit)) calc(1.2 * var(--ui-unit)); position: relative; }
.activity + .activity::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(to right, #a5946545 0, #a5946530 67%, transparent 80%); }
.activity .icon { width: calc(4.6 * var(--ui-unit)); height: calc(4.6 * var(--ui-unit)); }
.activity > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.24; text-shadow: 0 1px 2px #000a; }
.activity strong { font-weight: 500; font-size: 1.05em; margin-bottom: .13em; }
.activity span { font-size: .88em; white-space: nowrap; }
.activity time { display: block; margin-top: .06em; font-size: .96em; color: #edc56a; font-weight: 600; font-variant-numeric: tabular-nums; }
.muted { color: #d1bd7c; }
.submenus { align-self: center; background: linear-gradient(110deg,#1d2527e8,#141d21ee); border-radius: 5px 0 0 5px; overflow: hidden; box-shadow: -2px 2px 8px #0002; }
.submenus[hidden] { display: none; }
.submenu-button { width: 100%; border: 0; background: none; display: flex; align-items: center; gap: calc(1 * var(--ui-unit)); padding: calc(1.8 * var(--ui-unit)) calc(1 * var(--ui-unit)) calc(1.8 * var(--ui-unit)) calc(1.2 * var(--ui-unit)); min-height: calc(7.2 * var(--ui-unit)); text-align: left; font-size: 1em; }
.submenu-button + .submenu-button { border-top: 1px solid #ac8e4845; }
.submenu-button .icon { width: calc(3.2 * var(--ui-unit)); height: calc(3.2 * var(--ui-unit)); }
.submenu-button:hover { background: #d4ba7617; }
.submenu-button.active { background: linear-gradient(90deg,#6148277a,#61482725); color: #ffdc93; }
.bottom-nav { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #20282c none 32.262% 77.156% / 3096.296% 1960.417% no-repeat; border-top: 1px solid #c3a254; z-index: 2; }
.menu-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .16em; min-width: 0; border: 0; border-right: 1px solid #7d85722c; background: linear-gradient(130deg,#ffffff04,transparent 55%,#0000000a); padding: calc(.45 * var(--ui-unit)) calc(.1 * var(--ui-unit)); font-size: 1.06em; font-weight: 400; text-shadow: 0 1px 2px #0009; transition: background-color .16s; }
.menu-button:last-child { border-right: 0; }
.menu-button { position: relative; isolation: isolate; }
.menu-button::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 35% 15%, #ffffff0c, transparent 70%), linear-gradient(165deg, #ffffff05, transparent 45%, #00000012); opacity: 1; }
.menu-button > span { position: relative; z-index: 1; }
.menu-button .icon { height: calc(4.7 * var(--ui-unit)); width: calc(4.7 * var(--ui-unit)); max-width: none; }
.menu-button.active { background: radial-gradient(ellipse at 18% 18%,#d45b3336,transparent 65%), linear-gradient(130deg,#a72b20,#702016); box-shadow: inset 0 1px 0 #ddad61, inset -1px 0 #ad733f80, inset 0 -12px 20px #35100d1f; }
.menu-button.active::before { background: radial-gradient(ellipse at 28% 18%, #f4ad6630, transparent 75%), linear-gradient(160deg, #ffffff0a, transparent 45%, #25040028); opacity: 1; }
.menu-button:not(.active):hover { background: #d9bd7820; }
.workspace { align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: calc(1.2 * var(--ui-unit)) calc(1.7 * var(--ui-unit)); pointer-events: none; }
.workspace.visible { pointer-events: auto; }
.content-card { width: 100%; max-height: 100%; overflow: auto; padding: calc(1.45 * var(--ui-unit)) calc(1.7 * var(--ui-unit)); border: 1px solid #b799515e; border-radius: 6px; background: linear-gradient(135deg,#182328f5,#111b22f3); box-shadow: 0 5px 22px #0004; scrollbar-width: thin; scrollbar-color: #876d3c #182329; }
.content-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-bottom: 1px solid #af925148; padding-bottom: calc(.55 * var(--ui-unit)); margin-bottom: calc(.9 * var(--ui-unit)); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: #efd495; margin: 0; }
h1 { font-size: 1.7em; }
h2 { font-size: 1.3em; }
.close { background: none; border: 0; color: #e0cfa7; font-size: 1.8em; width: 1.5em; height: 1.5em; padding: 0; line-height: 1; }
.character-intro { display: flex; align-items: center; gap: calc(1.1 * var(--ui-unit)); margin: calc(.75 * var(--ui-unit)) 0; }
.character-intro > div { flex: 1; }
.character-intro p { margin: .3em 0 .6em; color: #dbd4c0; }
.character-portrait { width: calc(5.5 * var(--ui-unit)); height: calc(6.2 * var(--ui-unit)); margin: 0; }
.health-bar { background: linear-gradient(#bc3327,#76201c); border: 1px solid #c58463; border-radius: 4px; padding: .12em; text-align: center; font-size: .85em; }
.stats { margin: calc(.7 * var(--ui-unit)) 0; display: grid; grid-template-columns: 1fr 1fr; gap: calc(.35 * var(--ui-unit)) calc(1.4 * var(--ui-unit)); }
.stats > div { display: flex; justify-content: space-between; gap: .6em; padding: .4em .2em; border-bottom: 1px solid #9a885333; }
.stats dt { color: #d6d2c5; }
.stats dd { margin: 0; color: #edca75; }
.demo-caption { font-size: .69em; margin: .7em 0 0; color: #aca999; line-height: 1.3; }
.intro { font-size: .9em; margin: .65em 0; color: #c5c0af; }
.achievement { display: flex; align-items: center; gap: calc(.7 * var(--ui-unit)); padding: calc(.8 * var(--ui-unit)) 0; border-bottom: 1px solid #9a885333; }
.achievement > div { flex: 1; }
.achievement strong { font-weight: 500; color: #f1dab0; }
.achievement p { margin: .22em 0 .5em; font-size: .76em; color: #c8c4b4; }
.achievement .icon { height: calc(2.4 * var(--ui-unit)); width: calc(2.4 * var(--ui-unit)); }
.achievement-count { font-size: .78em; color: #ddbf79; min-width: 3.4em; text-align: right; }
.small-progress { height: calc(.45 * var(--ui-unit)); background: #060d12; border-radius: 6px; overflow: hidden; }
.small-progress i { display: block; height: 100%; background: linear-gradient(#91b877,#51844b); }
table { width: 100%; border-collapse: collapse; font-size: .9em; }
th { text-align: left; font-weight: 500; color: #b7ae94; font-size: .85em; padding: .5em; }
td { border-top: 1px solid #9a885333; padding: .65em .5em; }
th:last-child, td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.self { background: #866c362c; color: #ffe2a2; }
.self small { font-size: .8em; color: #ddbe7b; }
.placeholder { text-align: center; max-width: calc(34 * var(--ui-unit)); }
.placeholder > .icon { width: calc(5 * var(--ui-unit)); height: calc(5 * var(--ui-unit)); margin: calc(.5 * var(--ui-unit)); }
.placeholder h1 { margin: .3em 0; }
.placeholder p { font-size: .9em; color: #c7c1ae; }
.gold-button { background: linear-gradient(#e6c583,#af843d); color: #281d0d; border: 1px solid #e5c683; border-radius: 4px; padding: .65em 1.1em; margin: .6em; box-shadow: inset 0 1px #ffe4af66, 0 2px 4px #0004; }
.gold-button:hover { filter: brightness(1.08); }
.preview-note { width: min(720px, 100%); text-align: center; color: #828b92; font-size: 12px; letter-spacing: .06em; margin: 24px 0 0; }
dialog { width: min(430px, 80vw); border: 1px solid #a78b4e; border-radius: 9px; padding: 22px; color: #eee4cd; background: linear-gradient(130deg,#253136,#111a22); box-shadow: 0 14px 65px #0008; }
dialog::backdrop { background: #04090fb3; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid #8e774447; }
.empty-state { padding: 20px; text-align: center; color: #c2beae; }
.setting { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; gap: 15px; border-bottom: 1px solid #8e774428; font-size: 15px; }
.setting strong { font-weight: 400; color: #e5c77d; }
select { background: #162025; border: 1px solid #776442; padding: 7px; color: #eee4cd; border-radius: 4px; }
input { accent-color: #c9a559; width: 18px; height: 18px; }
.large-text .workspace { font-size: 1.12em; }
.reduce-motion *, .reduce-motion *::before { transition: none !important; animation: none !important; }
.orientation-hint { display: none; }
@media (max-width: 1100px) and (max-height: 550px) and (orientation: landscape) { body { padding: 0; background: #080e12; } .game { width: 100%; height: 100svh; aspect-ratio: auto; border-radius: 0; box-shadow: none; grid-template-rows: 16% 66% 18%; } .preview-note { display: none; } .topbar { padding-left: max(1.5%, env(safe-area-inset-left)); padding-right: max(1.5%, env(safe-area-inset-right)); } .portrait { width: calc(6 * var(--ui-unit)); height: calc(6.2 * var(--ui-unit)); margin-top: 0; } .activity-panel { margin-bottom: calc(.5 * var(--ui-unit)); } .activity { min-height: calc(6.4 * var(--ui-unit)); } .submenu-button { min-height: calc(6.7 * var(--ui-unit)); padding-top: calc(1.4 * var(--ui-unit)); padding-bottom: calc(1.4 * var(--ui-unit)); } }
@media (orientation: portrait) and (max-width: 900px) { body { padding: 16px; } .game { width: 100%; aspect-ratio: 2.12; font-size: max(5px,calc(1.42 * var(--ui-unit))); border-radius: 10px; } .orientation-hint { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 35px; gap: 5px; color: #cab987; font-size: 17px; } .orientation-hint .icon { width: 45px; height: 45px; } .preview-note { margin-top: 20px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Scale UI typography with the test screen; device panel ratio is 3120:1440. */
.topbar, .scene, .bottom-nav { font-size: calc(1.733333 * var(--ui-unit)); }





.icon-home { filter: url('#home-cutout') drop-shadow(0 1px 1px #0008); }



/* Fade the panel surface from its very first top pixel, without masking its content. */
.activity-panel::before { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 18px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 18px), transparent 100%); }


/* Reference menu materials: original pixels, with no procedural grain overlay. */
.bottom-nav { background: #22292b; border-top: 1px solid #c3a254; }
.menu-button { background: #22292b none 55.851% 34.921% / 1040% 257.5% no-repeat; font-size: 1.13em; gap: .13em; }
.menu-button::before { display: none; }
.menu-button.active { background: #842d22 none 7.03% 28% / 1134.545% 367.857% no-repeat; box-shadow: inset 0 1px 0 #c57e48aa, inset -1px 0 #c57e4870, inset 0 -1px 0 #b55a3b70; }
.menu-button .icon { width: calc(4.9 * var(--ui-unit)); height: calc(4.9 * var(--ui-unit)); }
/* No fade along the top edge: only the right-hand end dissolves. */
.activity-panel::before { -webkit-mask-image: none; mask-image: none; }


/* Keep the left/top edge solid; soften the top edge only inside the right fade band. */
.activity-panel::before {
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 84%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 14px);
  mask-image: linear-gradient(to right, #000 0%, #000 84%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 14px);
  -webkit-mask-composite: source-over;
  mask-composite: add;
}

@font-face { font-family: 'Gladius UI'; src: url("/assets/fonts/source-sans-3.ttf"); font-weight: 400; font-style: normal; font-display: swap; }
/* Match the reference's inset edges, humanist labels and warm gold highlight. */
.bottom-nav { border-top: 2px solid #d6b559; box-shadow: 0 -1px 2px #8e632e, inset 0 1px 0 #f3d88866; }
.menu-button { font-family: 'Gladius UI', 'Segoe UI', sans-serif; font-size: 1.27em; line-height: 1; gap: .19em; padding: calc(.55 * var(--ui-unit)) calc(.1 * var(--ui-unit)) calc(.65 * var(--ui-unit)); border-right: 1px solid #77817b25; box-shadow: inset 0 1px 1px #ffffff08, inset 0 -1px 3px #00000040; color: #f5ecc8; text-shadow: 0 1px 2px #000, 0 0 2px #e4cc7a25; }
.menu-button .icon { width: calc(4.7 * var(--ui-unit)); height: calc(4.7 * var(--ui-unit)); }
.menu-button.active { box-shadow: inset 0 2px 2px #d5743f88, inset -2px 0 2px #b8593677, inset 2px 0 2px #bd623d55, inset 0 -2px 2px #9e412a55; }

/* Restore the approved divider; give only the selected tile a worn, raised surface. */
.bottom-nav { border-top: 1px solid #c3a254; box-shadow: none; }
.menu-button.active {
  background:
    radial-gradient(ellipse at 18% 22%, #ed9b5624, transparent 35%),
    radial-gradient(ellipse at 70% 64%, #290b0a48, transparent 44%),
    radial-gradient(ellipse at 38% 94%, #35090940, transparent 38%),
    radial-gradient(ellipse at 92% 14%, #ca69421c, transparent 27%),
    linear-gradient(145deg, #892e22, #74271d 45%, #5e201a);
  box-shadow: inset 0 1px 1px #edc18499, inset 1px 0 1px #cb8a5b66, inset -1px 0 1px #b7744655, inset 0 -1px 1px #ab703f66, inset 0 3px 5px #26090848, inset 0 -5px 9px #24080838;
}
.menu-button.active::before {
  display: block;
  inset: 2px;
  border: 1px solid #c27d4930;
  background:
    radial-gradient(circle at 2px 2px, #efcd9677 0, #c69b6055 1px, transparent 3px),
    radial-gradient(circle at calc(100% - 2px) 2px, #efcd9688 0, #c69b6055 1px, transparent 3px),
    radial-gradient(circle at 2px calc(100% - 2px), #c9995d66 0, transparent 3px),
    radial-gradient(circle at calc(100% - 2px) calc(100% - 2px), #c9995d66 0, transparent 3px);
  opacity: 1;
  border-radius: 2px;
}
.menu-button .art-icon { filter: url('#icon-cutout') drop-shadow(0 2px 1px #000b) drop-shadow(1px 3px 3px #0008); }
.menu-button .icon-home { filter: url('#home-cutout') drop-shadow(0 2px 1px #000b) drop-shadow(1px 3px 3px #0008); }
.menu-button.active .art-icon { filter: url('#icon-cutout') drop-shadow(0 2px 1px #000d) drop-shadow(1px 4px 3px #0009); }
.menu-button.active .icon-home { filter: url('#home-cutout') drop-shadow(0 2px 1px #000d) drop-shadow(1px 4px 3px #0009); }

.progress-row { width: 75%; }
.xp { border-radius: 0 4px 4px 0; }
.xp-fill { border-radius: 0 3px 3px 0; }


/* Compact header actions with separators that dissolve at both ends. */
.topbar { padding-right: 1%; }
.currency + .currency { border-left: 0; }
.top-action { position: relative; border-left: 0; min-width: 3em; padding-left: calc(.75 * var(--ui-unit)); padding-right: calc(.25 * var(--ui-unit)); }
.top-action::before { content: ''; position: absolute; left: 0; top: 8%; bottom: 8%; width: 1px; background: linear-gradient(to bottom, transparent, #7d857240 30%, #7d857240 70%, transparent); pointer-events: none; }
.top-action:last-child { min-width: 2.8em; padding-right: 0; }

/* Larger profile portrait, extending slightly below the header divider. */
.profile .portrait {
  width: calc(7.2 * var(--ui-unit));
  height: calc(7.2 * var(--ui-unit));
  margin-top: calc(1.4 * var(--ui-unit));
  background-position: 5.421% 40.092%;
  background-size: 2495.522% 1383.824%;
  border: 1px solid #d0ac5e;
  box-shadow: 0 2px 4px #0009, inset 0 0 0 1px #f2d18d44;
}

/* Align the name with the level digits and refine the portrait rim. */
.profile-info > strong { padding-left: .48em; }
.profile .portrait {
  width: calc(7.8 * var(--ui-unit));
  height: calc(7.8 * var(--ui-unit));
  position: relative;
  border: 1.5px solid #d7b66c;
  filter: contrast(1.08) saturate(1.04);
  box-shadow: 0 2px 4px #000a, 0 0 0 1px #6d5329, inset 1px 1px 2px #fff0bd80, inset -2px -2px 3px #2d1b0c88;
}
.profile .portrait::after {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: #fff0bcbb;
  border-left-color: #e8c97e88;
  box-shadow: inset 0 0 0 2px #edc67822;
  pointer-events: none;
}
/* Diagonal joints keep the three exterior rails from overlapping at corners. */
body[data-preview="phone"] .game:not(.interior-open) #submenus {
  --rail-thickness: calc(var(--bar-source-height) * .085);
}
body[data-preview="phone"] .game:not(.interior-open) #submenus > .panel-edge-side {
  width: calc(var(--visible-rows-height) + var(--rail-thickness));
  clip-path: polygon(var(--rail-thickness) 0, calc(100% - var(--rail-thickness)) 0, 100% 100%, 0 100%);
}
body[data-preview="phone"] .game:not(.interior-open) #submenus > .panel-edge-top,
body[data-preview="phone"] .game:not(.interior-open) #submenus > .panel-edge-bottom {
  clip-path: polygon(var(--rail-thickness) 0, 100% 0, 100% 100%, 0 100%);
}

/* Soft shading across both full-width bars, without a luminous glow. */
.topbar, .bottom-nav { position: relative; }
.topbar::after, .bottom-nav::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, #ffffff07 0%, transparent 35%, #00000010 75%, #00000022 100%);
}
.profile .portrait {
  width: calc(8.2 * var(--ui-unit));
  height: calc(8.5 * var(--ui-unit));
  margin-top: calc(2.4 * var(--ui-unit));
  background-position: 4.855% 40.30%;
  background-size: 1944.186% 1045.556%;
  border: 0;
  filter: none;
  box-shadow: 0 2px 3px #0007;
  z-index: 1;
}
.profile .portrait::after { display: none; }

/* Clean circular portrait crop: no fragments from the reference outside its rim. */
.profile .portrait {
  width: calc(8.2 * var(--ui-unit));
  height: calc(8.2 * var(--ui-unit));
  overflow: hidden;
  background-position: 5.421% 40.092%;
  background-size: 2495.522% 1383.824%;
  background-clip: padding-box;
  border: 1.5px solid #c6a25c;
  box-shadow: 0 2px 3px #0007;
}
.topbar::after, .bottom-nav::after {
  background: linear-gradient(to bottom, #ffffff14 0%, #ffffff06 28%, transparent 45%, #00000026 76%, #0000004d 100%);
}

/* Uneven metallic rim: localized reflections, inner shading, outer depth. */
.profile .portrait {
  overflow: visible;
  border: 1.5px solid #b18d45;
  box-shadow: 1px 3px 4px #0009, -1px -1px 2px #0005, inset 2px 2px 4px #100c0880, inset -1px -1px 2px #f2d89630;
}
.profile .portrait::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  padding: 1.5px;
  border-radius: 50%;
  background: conic-gradient(from -35deg, #e7c878 0deg, #ffe7a3 28deg, #ab8034 88deg, #d4ae5a 135deg, #efd183 173deg, #b18b40 220deg, #edcd78 270deg, #b18b40 310deg, #e7c878 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.profile .portrait::after {
  display: block;
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid #30271970;
  box-shadow: inset 2px 2px 3px #0a090970, inset -1px -1px 2px #efce7930;
  pointer-events: none;
}

/* Barely visible inner edge; depth comes mainly from the outer shadow. */
.profile .portrait { box-shadow: 1px 3px 5px #000b, 0 0 2px 1px #0006; }
.profile .portrait::after { border: .5px solid #241b1540; box-shadow: none; }

/* Let city artwork show through the header and navigation surfaces. */
.game { background: #172126; }
.topbar { background: linear-gradient(160deg, #20272bd6, #151e23b3); }
.bottom-nav { background: transparent; }
.menu-button { background: linear-gradient(145deg, #22292bd1, #192228b3); }
.menu-button.active {
  background: radial-gradient(ellipse at 18% 22%, #ed9b5624, transparent 35%), radial-gradient(ellipse at 70% 64%, #290b0a38, transparent 44%), linear-gradient(145deg, #892e22df, #74271dc4 45%, #5e201abb);
}
.topbar::after, .bottom-nav::after { background: linear-gradient(to bottom, #ffffff08, transparent 45%, #0000001c); }

/* Restrained translucency and intermittent metallic highlights. */
:root { --gold-line: linear-gradient(90deg, #80602d 0%, #c3a254 12%, #f2d68e 18%, #b18c43 24%, #a58039 38%, #ead18a 43%, #b08a40 49%, #a07c38 65%, #f6df9e 72%, #bd984b 79%, #8a682e 90%, #d2af60 100%); }
.topbar { background: linear-gradient(160deg, #20272bf2, #151e23e8); border-bottom: 0; }
.topbar::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--gold-line); pointer-events: none; }
.bottom-nav { border-top: 0; }
.bottom-nav::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--gold-line); pointer-events: none; z-index: 2; }
.menu-button { background: linear-gradient(145deg, #22292bf0, #192228e6); }
.menu-button.active { background: radial-gradient(ellipse at 18% 22%, #ed9b5624, transparent 35%), radial-gradient(ellipse at 70% 64%, #290b0a38, transparent 44%), linear-gradient(145deg, #892e22f2, #74271dec 45%, #5e201ae8); }
.xp, .level { border-color: transparent; }
.xp::after, .level::after {
  content: ''; position: absolute; inset: 0; padding: 1px; border-radius: inherit; background: var(--gold-line);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.level { position: relative; }
.submenu-button + .submenu-button { border-top-color: transparent; position: relative; }
.submenu-button + .submenu-button::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--gold-line); opacity: .24; pointer-events: none; }
.content-card, dialog, .gold-button { border-color: transparent; background-origin: border-box; }
.content-card { background: linear-gradient(135deg,#182328f5,#111b22f3) padding-box, var(--gold-line) border-box; }
dialog { background: linear-gradient(130deg,#253136,#111a22) padding-box, var(--gold-line) border-box; }
.gold-button { background: linear-gradient(#e6c583,#af843d) padding-box, var(--gold-line) border-box; }
.menu-button.active::before { border-color: transparent; box-shadow: inset 0 1px 0 #eccb7d55, inset -1px 0 0 #b78b4540, inset 0 -1px 0 #d6b06533; }

/* Restore opaque bar materials; keep shading and gold reflections. */
.topbar { background: #20272b none 26.667% 38.764% / 2039.024% 1845.098% no-repeat; }
.bottom-nav { background: #22292b; }
.menu-button { background: #22292b none 55.851% 34.921% / 1040% 257.5% no-repeat; }
.menu-button.active { background: radial-gradient(ellipse at 18% 22%, #ed9b5624, transparent 35%), radial-gradient(ellipse at 70% 64%, #290b0a48, transparent 44%), radial-gradient(ellipse at 38% 94%, #35090940, transparent 38%), linear-gradient(145deg, #892e22, #74271d 45%, #5e201a); }
.level {
  border: 1px solid #c9a65b;
  background: linear-gradient(145deg,#65542e,#322719);
  box-shadow: 0 1px 2px #0008;
  overflow: hidden;
}
.level::after {
  inset: -1px;
  padding: 1px;
  border-radius: 50%;
  background: conic-gradient(from -35deg, #dfc27e, #efd594 35deg, #b18a3d 110deg, #d9b76a 190deg, #a27b35 255deg, #dfc27e);
}

/* Clear, fine leather grain instead of broad blurred patches. */
.menu-button.active {
  background:
    repeating-linear-gradient(18deg, #f7b7880b 0, #f7b7880b .6px, transparent .6px, transparent 3px),
    repeating-linear-gradient(108deg, #21070410 0, #21070410 .6px, transparent .6px, transparent 4px),
    linear-gradient(150deg, #963729 0%, #81291f 45%, #642017 100%);
  box-shadow: inset 0 1px 1px #edc18499, inset 1px 0 1px #cb8a5b66, inset -1px 0 1px #b7744655, inset 0 -1px 1px #ab703f66, inset 0 2px 3px #26090830, inset 0 -3px 4px #24080838;
}

/* Selected state inspired by the supplied red embossed button. */
.menu-button.active {
  background: linear-gradient(160deg, #8b302b 0%, #792824 48%, #64221f 100%);
  box-shadow: inset 0 2px 1px #df8d7799, inset 2px 0 1px #c06c5a66, inset -2px 0 1px #ae584b66, inset 0 -2px 1px #a3504266, inset 0 4px 4px #44100d44, inset 0 -4px 4px #3a0e0c44;
}
.menu-button.active::before {
  inset: 3px;
  border: 1px solid #c8776266;
  border-radius: 3px;
  box-shadow: inset 0 1px 1px #4a100b66, 0 1px 0 #e28d7333;
  background:
    radial-gradient(circle at 1px 1px, #f1b79b88 0, transparent 3px),
    radial-gradient(circle at calc(100% - 1px) 1px, #e8a38877 0, transparent 3px),
    radial-gradient(circle at 1px calc(100% - 1px), #bd705c77 0, transparent 3px),
    radial-gradient(circle at calc(100% - 1px) calc(100% - 1px), #bd705c77 0, transparent 3px);
}

/* Model 06: quiet wine-red surface with a single gold upper edge. */
.menu-button.active { background: radial-gradient(ellipse at 20% 20%, #963c3420, transparent 65%), linear-gradient(145deg,#571c1b,#3b1115); box-shadow: inset 0 2px 0 #dcb877, inset 0 3px 1px #73481e, inset 0 -2px 4px #17060766; }
.menu-button.active::before { display: none; }
.game[data-red-style="04-14"] .menu-button.active { background: #531612 none center / 100% 100% no-repeat; box-shadow: none; }
@media (max-width:1100px) and (max-height:550px) and (orientation:landscape) { .style-comparison { display:none; } }

/* Chosen combination: 04 bevel, 14 interior finish, 06 wine-red palette. */
.game[data-red-style="04-14"] .menu-button.active { background: linear-gradient(145deg,#571c1b,#3b1115); }
.game[data-red-style="04-14"] .menu-button.active::before {
  display: block;
  inset: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #571c1b none center / 100% 100% no-repeat;
  background-blend-mode: luminosity;
  filter: brightness(.78);
  opacity: 1;
}

/* Chosen profile 11: imperial name ribbon and laurel medallion. */
.profile { position: relative; width: 40%; gap: 2.3%; isolation: isolate; }
.profile-info { position: relative; z-index: 0; }
.profile-info > strong {
  position: relative;
  isolation: isolate;
  padding: .05em .85em .16em .38em;
  margin-bottom: .14em;
  color: #f6e3b1;
  font-family: Georgia, serif;
  font-size: 1.32em;
  text-shadow: 0 1px 2px #160303;
}
.profile-info > strong::before {
  content: ''; position: absolute; inset: -.12em -.1em -.05em -2.5em; z-index: -1;
  clip-path: polygon(0 0,100% 0,97% 50%,100% 100%,0 100%,2% 50%);
  background: linear-gradient(170deg,#b94b3d 0%,#7c231f 12%,#641817 68%,#3e0e11 100%);
  box-shadow: inset 0 1px #e790677d,inset 0 -1px #c18b496b,inset 0 3px 3px #22060955;
}
.profile-info > strong::after {
  content: ''; position: absolute; inset: .12em .15em .14em -2.2em; z-index: -1;
  clip-path: polygon(0 0,100% 0,97% 50%,100% 100%,0 100%);
  border-top: 1px solid #d4785b6b; border-bottom: 1px solid #ac6b3866;
  background: linear-gradient(130deg,#ffffff08,transparent 50%);
}
.profile .portrait { margin-top: calc(2 * var(--ui-unit)); width: calc(8 * var(--ui-unit)); height: calc(8 * var(--ui-unit)); z-index: 2; }
.portrait-laurel { position: absolute; width: 119%; height: 119%; left: -9.5%; top: -2%; pointer-events: none; filter: drop-shadow(0 1px 1px #000a); }
.profile .progress-row { width: 96%; }
.profile .level { width: 2.12em; height: 2.12em; background: linear-gradient(145deg,#6b5028,#342114); box-shadow: 0 1px 3px #000b,inset 0 0 0 2px #17110c; }
.profile .xp { height: 1.65em; border-radius: 0 7px 7px 0; background: linear-gradient(#151c18,#090f10); box-shadow: 0 1px 2px #0009; }
.profile .xp-fill { background: linear-gradient(#99c879,#578e47 55%,#3d6a32); border-radius: 0 4px 4px 0; }

/* Reference 11 artwork preserves its portrait/ribbon/frame proportions. */
.game { grid-template-rows: 15% 66% 19%; }
.topbar { padding-top: .65%; padding-bottom: .5%; }
.profile {
  width: calc(28 * var(--ui-unit)); height: calc(11 * var(--ui-unit)); flex: 0 0 calc(28 * var(--ui-unit)); display: block;
  background: none center / 100% 100% no-repeat;
  position: absolute; left: 2%; top: 0;
  margin: 0; z-index: 3;
}
.topbar .resources { margin-left: auto; }
.profile .portrait { display: none; }
.profile-info { position: absolute; inset: 0; display: block; }
.profile-info > strong {
  position: absolute; top: 17%; left: 40%; width: 55%; height: 26%;
  display: grid; place-items: center; padding: 0; margin: 0;
  font: bold calc(2.05 * var(--ui-unit)) / 1 Georgia, serif; color: #f6e5b9;
  text-shadow: 0 1px 1px #080302;
}
.profile-info > strong::before, .profile-info > strong::after { display: none; }
.profile .progress-row { position: absolute; inset: 0; width: 100%; display: block; }
.profile .level {
  position: absolute; top: 45%; left: 39%; width: 14%; height: 38%;
  border: 0; background: none; box-shadow: none; overflow: visible;
  font: calc(1.95 * var(--ui-unit)) / 1 Georgia, serif; color: #f8f0dd; text-shadow: 0 1px 2px #000;
}
.profile .level::after { display: none; }
.profile .xp {
  position: absolute; top: 49%; left: 53%; width: 43%; height: 29%;
  margin: 0; border: 0; background: none; box-shadow: none; overflow: visible;
}
.profile .xp::after, .profile .xp-fill { display: none; }
.profile .xp-value { font-size: calc(1.35 * var(--ui-unit)); padding: 0; color: #f8f0dd; }
.profile { left: .7%; background-image: none; }
.profile .level { top: 43.5%; }
.profile .xp { top: 47.5%; }

/* Painted metallic bevel: a lit upper edge, dark lower edge, uneven reflections. */
.topbar::before, .bottom-nav::before {
  height: 3px;
  background:
    linear-gradient(to bottom, #fff8d8aa 0%, #fff0b344 23%, transparent 45%, #69431566 75%, #291d11aa 100%),
    linear-gradient(90deg,#8c682b 0%,#cfa54e 10%,#fff5c2 17%,#a37630 28%,#e2b85f 42%,#fff2b0 47%,#a27832 59%,#d8b05e 71%,#fff3bc 79%,#a27a35 88%,#dab564 100%);
  background-blend-mode: normal;
  box-shadow: 0 1px 2px #000a, 0 -1px 1px #0005;
}
@media (max-width:1100px) and (max-height:550px) and (orientation:landscape) {
  .game { grid-template-rows: 16% 66% 18%; }
}

/* Raster tile includes the bar surface AND its gold boundary; repeat, never stretch across the screen. */
.topbar {
  background: #20272b none left bottom / auto 100% repeat-x;
}
.topbar::before { display: none; }
.topbar::after { display: none; }
.bottom-nav { isolation: isolate; background: #20272b; }
.bottom-nav::before {
  display: block; inset: 0; width: auto; height: auto; z-index: -1;
  background: none left bottom / auto 100% repeat-x;
  transform: scaleY(-1); box-shadow: none;
}
.bottom-nav::after { display: none; }
.menu-button:not(.active) { background: transparent; }
.menu-button:not(.active)::before { background: none; }
.preview-controls {
  position: fixed; bottom: 10px; right: 12px; z-index: 20;
  display: flex; gap: 4px; padding: 4px; background: #111a20ed;
  border: 1px solid #766440; border-radius: 6px;
}
.preview-controls button { font: 12px 'Segoe UI',sans-serif; padding: 5px 10px; border: 0; border-radius: 3px; background: transparent; color: #ddd3bc; }
.preview-controls button[aria-pressed="true"] { background: #63472d; color: #fff0c9; }
body[data-preview="tablet"] .game {
  width: min(1000px,100%,calc((100svh - 100px) * 1.6));
  height: auto; aspect-ratio: 8 / 5; grid-template-rows: 12% 73% 15%;
}
body[data-preview="tablet"] .orientation-hint { display: none; }

/* Requested overlap moves only level/experience; portrait and title stay anchored. */
.profile { background-image: none; }
.profile .progress-row { transform: translateX(-12%); }
.topbar { background-image: var(--stone-dark-skin,linear-gradient(#252726,#151916)); }
.bottom-nav::before { background-image: var(--stone-dark-skin,linear-gradient(#252726,#151916)); }

/* Activity tabs always start at the top; overflow stays inside this panel. */
.activity-panel {
  align-self: start; margin-top: calc(2.5 * var(--ui-unit)); margin-bottom: calc(1.1 * var(--ui-unit));
  min-height: 0; max-height: calc(100% - calc(3.6 * var(--ui-unit)));
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
  touch-action: pan-y; overscroll-behavior-y: contain;
}
.activity-panel::-webkit-scrollbar { display: none; }
.activity-panel.is-dragging { cursor: grabbing; user-select: none; }
.profile { background-image: none; }
.profile .progress-row { transform: translateX(-6%); }

/* Android follows the test container; desktop keeps the tablet's physical UI scale. */
.game { --ui-unit: 1cqw; }
body[data-preview="web"] { padding: 0; overflow: hidden; }
body[data-preview="web"] .game {
  --ui-unit: 7.5px;
  width: 100%; height: 100svh; aspect-ratio: auto;
  border-radius: 0; box-shadow: none;
  grid-template-rows: 56.25px minmax(0,1fr) 70.5px;
}
body[data-preview="web"] .topbar { padding: 6px 16px; }
body[data-preview="web"] .profile { left: 7px; }
body[data-preview="web"] .scene { grid-template-columns: 187.5px minmax(0,1fr) 127.5px; background-size: cover; }
body[data-preview="web"] .bottom-nav { grid-template-columns: repeat(7,minmax(0,107.25px)); justify-content: center; }
body[data-preview="web"] .preview-note,
body[data-preview="web"] .style-comparison,
body[data-preview="web"] .orientation-hint { display: none; }
body[data-preview="web"] .preview-controls { bottom: 3px; }
@media(max-width:1000px) {
  body[data-preview="web"] .bottom-nav { grid-template-columns: repeat(7,minmax(0,1fr)); }
}

/* Larger screens extend the surface, not the phone's controls. */
body[data-preview="tablet"] .game { --ui-unit: 7.2px; grid-template-rows: 50px minmax(0,1fr) 63px; }
body[data-preview="tablet"] .scene { grid-template-columns: 180px minmax(0,1fr) 122px; }
body[data-preview="tablet"] .bottom-nav { grid-template-columns: repeat(7,minmax(0,103px)); justify-content: center; }
body[data-preview="tablet"] .scene,
body[data-preview="web"] .scene { background-image: none; }

/* Fixed inset and shared shadows: tablet width must not move the profile. */
body[data-preview="phone"] .profile,
body[data-preview="tablet"] .profile { left: calc(.7 * var(--ui-unit)); filter: drop-shadow(0 2px 2px #0009); }
body[data-preview="phone"] .topbar,
body[data-preview="tablet"] .topbar { box-shadow: 0 3px 5px #0008; }
body[data-preview="phone"] .bottom-nav,
body[data-preview="tablet"] .bottom-nav { box-shadow: 0 -2px 4px #0007; }

/* Matching side panels, mirrored toward the scene, with four visible rows. */
.activity-panel, .submenus {
  align-self: start; margin-top: calc(2.5 * var(--ui-unit)); margin-bottom: calc(1.1 * var(--ui-unit));
  display: flex; flex-direction: column; min-height: 0;
  max-height: calc(100% - calc(3.6 * var(--ui-unit)));
  overflow: hidden; border-radius: 0; box-shadow: none; isolation: isolate;
}
.activity-panel { background: linear-gradient(to right,#142025e8 0%,#172428dc 67%,transparent 100%); }
.activity-panel::before { display: none; }
.submenus { background: linear-gradient(to left,#142025e8 0%,#172428dc 67%,transparent 100%); }
.panel-scroll {
  min-height: 0; max-height: var(--four-rows-height,calc(28 * var(--ui-unit)));
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none;
  touch-action: pan-y; overscroll-behavior-y: contain; flex-shrink: 1;
}
.panel-scroll::-webkit-scrollbar { display: none; }
.panel-scroll.is-dragging { cursor: grabbing; user-select: none; }
.activity, .submenu-button { min-height: calc(6.1 * var(--ui-unit)); flex-shrink: 0; }
.activity > div { line-height: 1.18; }
.activity-panel { max-height: calc(100% - calc(2.5 * var(--ui-unit))); margin-bottom: 0; }
.submenu-button {
  position: relative; padding: calc(.48 * var(--ui-unit)) calc(1.2 * var(--ui-unit)) calc(.48 * var(--ui-unit)) calc(.6 * var(--ui-unit));
  gap: calc(.6 * var(--ui-unit)); font-size: 1.05em; font-weight: 500; text-shadow: 0 1px 2px #000a;
}
.submenu-button .icon { width: calc(4.6 * var(--ui-unit)); height: calc(4.6 * var(--ui-unit)); }
.submenu-button + .submenu-button { border-top: 0; }
.submenu-button + .submenu-button::before {
  content: ''; position: absolute; top: 0; right: 0; left: 0; height: 1px;
  background: linear-gradient(to left,#a5946545 0,#a5946530 67%,transparent 100%);
}
.submenu-button { padding-left: calc(.8 * var(--ui-unit)); padding-right: calc(.8 * var(--ui-unit)); }

/* Right-hand activities use the exact left-hand structure, with mirrored insets. */
.scene { grid-template-columns: 25% 50% 25%; }
body[data-preview="tablet"] .scene { grid-template-columns: 180px minmax(0,1fr) 180px; }
body[data-preview="web"] .scene { grid-template-columns: 187.5px minmax(0,1fr) 187.5px; }
.submenus { max-height: calc(100% - calc(2.5 * var(--ui-unit))); margin-bottom: 0; }
.submenu-button {
  justify-content: flex-end; font-size: 1em; font-weight: 400;
  padding: calc(.48 * var(--ui-unit)) calc(1.2 * var(--ui-unit)) calc(.48 * var(--ui-unit)) calc(2 * var(--ui-unit));
  gap: calc(.6 * var(--ui-unit)); text-align: right;
}
.submenu-button > div { align-items: flex-end; }
.submenu-button + .submenu-button::before {
  background: linear-gradient(to left,#a5946545 0,#a5946530 67%,transparent 80%);
}

/* Approved alignment shared by phone, tablet and Web. */
.submenu-button { height: var(--phone-side-row-0); min-height: 0; }
.submenu-button:nth-child(4n + 2) { height: var(--phone-side-row-1); }
.submenu-button:nth-child(4n + 3) { height: var(--phone-side-row-2); }
.submenu-button:nth-child(4n + 4) { height: var(--phone-side-row-3); }
.submenu-button > div { justify-content: center; }
.submenu-button strong { margin-bottom: 0; }
.submenu-button .muted { display: none; }
body[data-preview="phone"] .scene { background-image: none; background-size: cover; background-position: center 20%; }

/* Native transparent HD masters keep the same compact UI dimensions. */
.game .icon.hd-icon {
  display: block; object-fit: contain; object-position: center;
  background: none; filter: drop-shadow(0 1px 1px #0008);
}

/* Empty interior shells: parchment panels with imperial red/bronze framing. */
.interior-window[hidden] { display: none; }
.interior-window {
  grid-column: 1 / -1; grid-row: 1; align-self: stretch; min-height: 0; min-width: 0;
  margin: 0; display: grid; grid-template-columns: minmax(0,1fr) 25%;
  padding: 5px; position: relative; isolation: isolate;
  border: 3px solid #713025; border-radius: 2px;
  background: #d4bd8d url("/assets/ui/material-grain.svg");
  box-shadow: inset 0 0 0 1px #f0d389, inset 0 0 0 3px #8f6e35, inset 0 0 28px #6d491b55, 0 3px 12px #0009;
}
.interior-window::after {
  content: ''; position: absolute; inset: 4px; border: 1px solid #b18b47;
  box-shadow: inset 0 1px #fff0b55e; pointer-events: none; z-index: 3;
}
.interior-open .workspace { padding: 0; align-items: stretch; }
.interior-open .content-card {
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
  color: #372817; height: 100%; max-height: 100%; display: flex; flex-direction: column;
  padding: 9px 13px; scrollbar-width: none;
}
.interior-open .content-heading { flex: 0 0 auto; margin: 0; padding: 0 0 6px; border-bottom: 1px solid #8b663944; }
.interior-open h1 { color: #362617; font-size: 1.45em; text-shadow: 0 1px #fff2c47a; }
.interior-open .close { color: #5d3b1f; font-size: 1.65em; }
.empty-window-body { flex: 1; min-height: 0; }
.interior-window > .submenus {
  grid-column: 2; margin: 0; max-height: 100%; height: 100%; align-self: stretch;
  background: #1b2528 url("/assets/ui/material-grain.svg");
  border-left: 2px solid #987c42; box-shadow: -2px 0 5px #53371540;
}
.interior-window .submenu-button { padding-left: 7px; }
body[data-preview="phone"] .interior-open #activities { display: none; }
body[data-preview="tablet"] .interior-window { grid-column: 2 / 4; grid-template-columns: minmax(0,1fr) 180px; margin: 12px 10px 12px 0; }
body[data-preview="web"] .interior-window { grid-column: 2; grid-template-columns: minmax(0,1fr); margin: 18px; }
body[data-preview="web"] .interior-open .content-card { padding: 18px 24px; }
.scene > .activity-panel { grid-column: 1; grid-row: 1; }
.scene > .workspace { grid-column: 2; grid-row: 1; }
.scene > .submenus { grid-column: 3; grid-row: 1; }
.interior-window > .workspace { grid-column: 1; grid-row: 1; }
.interior-window > .submenus { grid-row: 1; }
/* User requested quiet surfaces with no outlines around the interior. */
.interior-window {
  border: 0; border-radius: 0; padding: 0;
  background: #e1d2b0;
  box-shadow: none;
}
.interior-window::after { display: none; }
.interior-window > .submenus {
  border: 0; box-shadow: none;
  background: #182125 var(--stone-dark-skin,linear-gradient(#252726,#151916)) top left / 256px auto repeat;
}
.interior-window .submenu-button.active { background: #b28c3430; }
.interior-window > .submenus { background: linear-gradient(110deg,#202a2e,#151e22); }
.interior-window { background: #e7dcc7 none center / 625px 625px repeat; }
body[data-preview="phone"] .interior-window { grid-template-columns: minmax(0,1fr) calc(7 * var(--ui-unit)); }
body[data-preview="phone"] .interior-window .submenu-button > div { display: none; }
body[data-preview="phone"] .interior-window .submenu-button { justify-content: center; padding-left: 0; padding-right: 0; }
/* Framed central windows on Tablet and Web; compact integrated rail on Phone. */
body[data-preview="tablet"] .interior-window { grid-column: 2; grid-template-columns: minmax(0,1fr); margin: 14px 10px; }
.interior-window {
  border: 2px solid #8e713f; padding: 2px; border-radius: 3px;
  box-shadow: inset 0 0 0 1px #f1d4919e, 0 1px 0 #dfbf75, 0 4px 12px #0008;
}
.interior-window::after { display: block; inset: 2px; border: 1px solid #604c2b66; box-shadow: none; }
.interior-open .content-heading { justify-content: flex-end; gap: 10px; }
.interior-open h1 { margin-left: auto; text-align: right; }
.window-back {
  display: flex; align-items: center; gap: 5px; padding: 3px 8px;
  border: 1px solid #937540; border-radius: 3px;
  background: linear-gradient(#4c493a,#292a25); color: #ecd39b;
  box-shadow: inset 0 1px #e6cd8244, 0 1px 2px #0005; font-size: .85em;
}
.window-back > span:first-child { font-size: 1.65em; line-height: .8; }
.submenu-button.active { background: linear-gradient(to left,#ad84332e,#6b572a12); color: #ffe1a0; }
.submenu-button.active::after {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 15px; height: 32px; background: url("/assets/ui/submenu-arrow.svg") center / 100% 100% no-repeat;
  pointer-events: none;
}
body[data-preview="phone"] .submenu-button.active::after { width: 7px; height: 25px; }
.interior-window.dark-material .content-heading h1 { color: #efd9a6; text-shadow: 0 1px #0009; }
.interior-window.dark-material .content-heading { border-bottom-color: #ccb17a40; }

.interior-window { background-image: url("/assets/backgrounds/interior.webp"); }

/* Selected frame 01: slender gold rails, fixed-size corners and extending edges. */
body[data-preview="tablet"] .interior-window,
body[data-preview="web"] .interior-window {
  border: 0;
  border-image: none;
  border-radius: 0;
  /* Compensate the source PNG's transparent top/bottom margins. */
  margin: calc(2.5 * var(--ui-unit) - 15px) 10px calc(2.5 * var(--ui-unit) - 14px);
  padding: 40px 18px 18px;
  background: transparent !important;
  box-shadow: none;
}
.interior-window::after { display: none; }
body[data-preview="tablet"] .interior-window::before,
body[data-preview="web"] .interior-window::before {
  content: ''; position: absolute; inset: 32px 15px 15px;
  background: #e7dcc7 url("/assets/backgrounds/interior.webp") center / 625px 625px repeat;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  z-index: -1; pointer-events: none;
}
body[data-preview="tablet"] .interior-window::after,
body[data-preview="web"] .interior-window::after {
  content: ''; display: block; position: absolute; inset: 0;
  border: solid transparent; border-width: 72px 27px 30px;
  border-image: url("/assets/ui/window-frame.webp") 360 180 200 180 / 72px 27px 30px 27px stretch;
  box-shadow: none; filter: drop-shadow(0 3px 4px #0006);
  z-index: 3; pointer-events: none;
}
body[data-preview="phone"] .interior-window {
  border: 0;
  border-image: none;
  border-radius: 0;
  padding: 0;
  background-clip: border-box;
  box-shadow: none;
}

/* Interior headings are redundant with the persistent submenu navigation. */
.interior-open .content-heading { border: 0; padding: 0; }
.window-back {
  width: calc(13 * var(--ui-unit)); height: calc(4.3 * var(--ui-unit));
  justify-content: center; padding: 0 0 0 calc(2.6 * var(--ui-unit));
  border: 0; border-radius: 0; box-shadow: none;
  background: url("/assets/ui/window-back.webp") center / 128% 180% no-repeat;
  filter: drop-shadow(0 1px 1px #0005); color: #f1d79e;
}
.window-back > .window-back-label:first-child { font-size: 1em; line-height: 1; }
.window-back:hover { filter: brightness(1.12) drop-shadow(0 1px 1px #0005); }
.window-back:focus-visible { outline: 2px solid #b78c42; outline-offset: 3px; }

/* Phone navigation preserves the city icon coordinates when labels disappear. */
body[data-preview="phone"] .interior-window > .submenus {
  margin-top: calc(2.5 * var(--ui-unit));
  height: calc(100% - 2.5 * var(--ui-unit));
  max-height: calc(100% - 2.5 * var(--ui-unit));
}
body[data-preview="phone"] .interior-window .submenu-button {
  justify-content: flex-end; padding-right: calc(1.2 * var(--ui-unit));
}

/* Close control: same label typography as the submenu, with an X on the right. */
.window-back {
  width: auto; height: auto; min-height: calc(4.3 * var(--ui-unit));
  gap: calc(.8 * var(--ui-unit)); padding: 0 calc(.8 * var(--ui-unit));
  background: none; filter: none; color: #66502c;
  font-size: 1em; font-weight: 700; text-shadow: 0 1px #fff8;
}
.window-back:hover { filter: none; color: #9d702c; background: #ad843312; }
.window-close-icon { width: calc(2.7 * var(--ui-unit)); height: calc(2.7 * var(--ui-unit)); fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; }

/* Selection decor is layered around the existing icon without moving it. */
.submenu-button.active,
.interior-window .submenu-button.active { background: transparent; color: #ffe1a0; }
.submenu-button.active::after,
body[data-preview="phone"] .submenu-button.active::after {
  content: ''; position: absolute; left: auto; right: calc(-.39 * var(--ui-unit));
  top: 50%; width: calc(7.2 * var(--ui-unit)); height: calc(7.2 * var(--ui-unit));
  transform: translateY(-47.5%);
  background: none center / contain no-repeat;
  z-index: 0; pointer-events: none;
}
.submenu-button.active > div, .submenu-button.active > .icon { position: relative; z-index: 1; }
body[data-preview="phone"] .submenu-button.active::before { display: none; }
body[data-preview="tablet"] .submenu-button.active::before,
body[data-preview="web"] .submenu-button.active::before {
  content: ''; position: absolute; left: calc(.8 * var(--ui-unit)); right: calc(3.5 * var(--ui-unit));
  top: 50%; height: calc(5.8 * var(--ui-unit)); transform: translateY(-50%);
  background: none center / 100% 100% no-repeat;
  opacity: 1; z-index: 0; pointer-events: none;
}

/* Wider central shell; the two navigation columns keep their coordinates. */
body[data-preview="tablet"] .interior-window,
body[data-preview="web"] .interior-window {
  margin-left: -20px;
  margin-right: -20px;
}
/* The round inset fits inside the complete selected-button outline. */
body[data-preview="tablet"] .submenu-button.active::before,
body[data-preview="web"] .submenu-button.active::before {
  left: calc(.8 * var(--ui-unit)); right: 0;
  height: calc(7.4 * var(--ui-unit));
  background-size: 100% 130%;
}
body[data-preview="tablet"] .submenu-button.active::after,
body[data-preview="web"] .submenu-button.active::after {
  right: calc(.15 * var(--ui-unit));
  width: calc(6.2 * var(--ui-unit)); height: calc(6.2 * var(--ui-unit));
}
/* Fill the gap up to the side columns without covering their buttons. */
body[data-preview="tablet"] .interior-window,
body[data-preview="web"] .interior-window { margin-left: -8px; margin-right: -8px; }
.window-back { font-size: 1.05em; }

/* Chosen full-row selection: model 07 arrow and model 05 warm gold surface. */
body[data-preview="tablet"] .submenu-button.active,
body[data-preview="web"] .submenu-button.active {
  color: #302414; text-shadow: 0 1px #ffe8ac66;
}
body[data-preview="tablet"] .submenu-button.active::before,
body[data-preview="web"] .submenu-button.active::before {
  inset: 0; height: auto; transform: none;
  background: none center / 100% 200% no-repeat;
}
body[data-preview="tablet"] .submenu-button.active::after,
body[data-preview="web"] .submenu-button.active::after { display: none; }

/* Final selected treatment: black graphite inset and gold arrow/rails. */
body[data-preview="tablet"] .submenu-button.active,
body[data-preview="web"] .submenu-button.active {
  color: #ffe1a0; text-shadow: 0 1px 2px #000a;
}
body[data-preview="tablet"] .submenu-button.active::before,
body[data-preview="web"] .submenu-button.active::before {
  background-image: none;
}
body[data-preview="phone"] .submenu-button.active::after { display: none; }
body[data-preview="phone"] .submenu-button.active::before {
  content: ''; display: block; position: absolute; inset: 0;
  height: auto; transform: none; opacity: 1; z-index: 0; pointer-events: none;
  background: none left center / calc(10 * var(--ui-unit)) 200% no-repeat;
}

/* Compensate artwork alpha so the gold rail reaches the bottom of each row. */
body[data-preview="tablet"] .submenu-button.active::before,
body[data-preview="web"] .submenu-button.active::before {
  background-size: 100% 208%; background-position: center 44.5%;
}
body[data-preview="phone"] .submenu-button.active::before {
  background-size: calc(10 * var(--ui-unit)) 208%; background-position: left 44.5%;
}
/* Extend the band entry toward the window; its right edge and content stay put. */
body[data-preview="tablet"] .scene > .submenus,
body[data-preview="web"] .scene > .submenus {
  width: calc(100% + 8px); margin-left: -8px;
}

/* Phone crops the long band; the left arrow keeps the Tablet artwork scale. */
body[data-preview="phone"] .interior-window > .submenus {
  width: calc(11 * var(--ui-unit)); margin-left: calc(-4 * var(--ui-unit));
  background: linear-gradient(to left,#182125 0,#182125 calc(7 * var(--ui-unit)),transparent calc(7 * var(--ui-unit)));
}
body[data-preview="phone"] .submenu-button.active::before {
  background-size: calc(26 * var(--ui-unit)) 208%;
}

/* Full-height side columns; the scroll viewport ends after a complete row. */
body[data-preview="tablet"] .activity-panel,
body[data-preview="tablet"] .submenus,
body[data-preview="web"] .activity-panel,
body[data-preview="web"] .submenus {
  height: calc(100% - 5 * var(--ui-unit));
  max-height: calc(100% - 5 * var(--ui-unit));
  margin-bottom: calc(2.5 * var(--ui-unit));
}
.panel-scroll { max-height: 100%; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) {
  .interior-window { animation: none; }
}
/* Charcoal ends with the visible list, with a short fade below its last row. */
.activity-panel, .submenus,
body[data-preview="phone"] .interior-window > .submenus { background: transparent; position: relative; }
.activity-panel::before, .submenus::before {
  content: ''; position: absolute; inset: 0 0 auto;
  height: calc(var(--visible-rows-height, 0px) + 8px);
  pointer-events: none; z-index: -1;
  background: linear-gradient(to right,#142025e8 0%,#172428dc 67%,transparent 100%);
  mask-image: linear-gradient(to bottom,#000 calc(100% - 8px),transparent);
}
.submenus::before { background: linear-gradient(to left,#142025e8 0%,#172428dc 67%,transparent 100%); }
body[data-preview="phone"] .interior-window > .submenus::before {
  background: linear-gradient(to left,#182125 0,#182125 calc(7 * var(--ui-unit)),transparent calc(7 * var(--ui-unit)));
}
.panel-scroll { overflow-anchor: none; }
.activity-panel::before, .submenus::before {
  display: block; width: 100%; top: 0; bottom: auto; left: 0; right: 0; transform: none;
}
/* Stable slots let native scrolling settle without JS timers or relayout. */
.panel-scroll { scroll-snap-type: y mandatory; scroll-behavior: auto; }
.panel-scroll.is-dragging { scroll-snap-type: none; }
.panel-scroll > .activity,
.panel-scroll > .submenu-button:nth-child(n) {
  height: var(--panel-row-height); min-height: var(--panel-row-height);
  scroll-snap-align: start; box-sizing: border-box;
}
.activity-panel::before, .submenus::before {
  height: var(--visible-rows-height, 0px);
}
body[data-preview="phone"] .activity-panel,
body[data-preview="phone"] .submenus,
body[data-preview="phone"] .interior-window > .submenus {
  margin-top: 0;
  height: 100%; max-height: 100%;
}
/* Match the quiet lower fade at the top of both side-panel backgrounds. */
.activity-panel::before, .submenus::before {
  mask-image: linear-gradient(to bottom, transparent, #000 8px, #000 calc(100% - 8px), transparent);
}
/* Phone keeps the original anchors and alternating notification-sized rows. */
body[data-preview="phone"] .activity-panel,
body[data-preview="phone"] .submenus,
body[data-preview="phone"] .interior-window > .submenus {
  margin-top: calc(2.5 * var(--ui-unit));
  height: calc(100% - 2.5 * var(--ui-unit));
  max-height: calc(100% - 2.5 * var(--ui-unit));
}
body[data-preview="phone"] .panel-scroll > .activity:nth-child(n) {
  height: var(--phone-side-row-0); min-height: 0;
}
body[data-preview="phone"] .panel-scroll > .activity:nth-child(4n + 2) { height: var(--phone-side-row-1); }
body[data-preview="phone"] .panel-scroll > .activity:nth-child(4n + 3) { height: var(--phone-side-row-2); }
body[data-preview="phone"] .panel-scroll > .activity:nth-child(4n + 4) { height: var(--phone-side-row-3); }
body[data-preview="phone"] .activity-panel .panel-scroll > .activity:nth-child(-n + 4) {
  height: auto; min-height: calc(6.1 * var(--ui-unit));
}
/* No vertical fades on side-panel backgrounds in any preview mode. */
.activity-panel::before, .submenus::before {
  -webkit-mask-image: none;
  mask-image: none;
}
/* End each side list with the same subdued raster rail as the main bars. */
.activity-panel::after, .submenus::after {
  content: ''; position: absolute; inset: 0 0 auto;
  height: var(--visible-rows-height, 0px); pointer-events: none; z-index: 2;
  background-image: var(--stone-dark-skin,linear-gradient(#252726,#151916)), var(--stone-dark-skin,linear-gradient(#252726,#151916));
  background-size: auto 64px; background-repeat: repeat-x;
  background-position: left -61px, left bottom;
  mask-image: linear-gradient(to bottom,#000 3px,transparent 3px,transparent calc(100% - 3px),#000 calc(100% - 3px)),linear-gradient(to right,#000 67%,transparent);
  mask-composite: intersect;
}
.submenus::after {
  mask-image: linear-gradient(to bottom,#000 3px,transparent 3px,transparent calc(100% - 3px),#000 calc(100% - 3px)),linear-gradient(to left,#000 67%,transparent);
}
body[data-preview="phone"] .interior-window > .submenus::after {
  right: 0; left: auto; width: calc(7 * var(--ui-unit));
}
/* Thicker bar-matched rails fade out before the charcoal background does. */
.activity-panel::after, .submenus::after {
  background-size: auto 96px;
  background-position: left -91px, left bottom;
  mask-image: linear-gradient(to bottom,#000 5px,transparent 5px,transparent calc(100% - 5px),#000 calc(100% - 5px)),linear-gradient(to right,#000 45%,transparent 75%);
}
.submenus::after {
  mask-image: linear-gradient(to bottom,#000 5px,transparent 5px,transparent calc(100% - 5px),#000 calc(100% - 5px)),linear-gradient(to left,#000 45%,transparent 75%);
}
/* The lower rail sits below the charcoal surface, with no black trailing strip. */
.activity-panel::after, .submenus::after {
  height: calc(var(--visible-rows-height, 0px) + 5px);
}
body[data-preview="phone"] .activity-panel,
body[data-preview="phone"] .submenus,
body[data-preview="phone"] .interior-window > .submenus {
  margin-top: var(--phone-panel-top, calc(2.5 * var(--ui-unit)));
  height: calc(100% - var(--phone-panel-top, calc(2.5 * var(--ui-unit))));
  max-height: calc(100% - var(--phone-panel-top, calc(2.5 * var(--ui-unit))));
}
/* Fine rail positioning: upper edge +2px, lower edge +3px. */
.activity-panel::after, .submenus::after {
  top: 2px;
  height: calc(var(--visible-rows-height, 0px) + 6px);
}
/* Exact top-bar edge sample, with independent outward shadows. */
.activity-panel, .submenus { overflow: visible; }
.activity-panel::after, .submenus::after { display: none; }
.panel-edge {
  position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none;
  height: calc(var(--bar-source-height) * .085);
  background: var(--stone-dark-skin,linear-gradient(#252726,#151916)) left bottom / auto var(--bar-source-height) repeat-x;
  mask-image: linear-gradient(to right,#000 45%,transparent 75%);
}
.submenus > .panel-edge { mask-image: linear-gradient(to left,#000 45%,transparent 75%); }
.panel-edge-top { top: 0; transform: scaleY(-1); filter: drop-shadow(0 2px 2px #0007); }
.panel-edge-bottom { top: var(--visible-rows-height); filter: drop-shadow(0 2px 2px #0007); }
body[data-preview="phone"] .interior-window > .submenus > .panel-edge {
  left: auto; width: calc(7 * var(--ui-unit));
}
/* Phone opens the page behind the existing full-width side panels. */
body[data-preview="phone"] .interior-window {
  grid-column: 1 / -1; grid-row: 1; grid-template-columns: minmax(0,1fr);
  margin: 0; padding: 0; z-index: 0;
}
body[data-preview="phone"] .interior-window::before,
body[data-preview="phone"] .interior-window::after { display: none; }
body[data-preview="phone"] .scene > .activity-panel,
body[data-preview="phone"] .scene > .submenus { z-index: 1; }
body[data-preview="phone"] .interior-open #activities { display: flex; }
body[data-preview="phone"] .submenu-button > div { display: none; }
body[data-preview="phone"] .submenu-button.active::before {
  inset: 0 0 0 auto; width: calc(11 * var(--ui-unit));
}
/* Selected model 02: thin rails and broad integrated left chevron. */
body[data-preview="tablet"] .submenu-button.active::before,
body[data-preview="web"] .submenu-button.active::before {
  background: url("/assets/ui/submenu-selected.webp") 54% 48% / 111% 254% no-repeat;
}
body[data-preview="phone"] .submenu-button.active::before {
  background: url("/assets/ui/submenu-selected.webp") calc(-1.5 * var(--ui-unit)) 48% / calc(29 * var(--ui-unit)) 254% no-repeat;
}

/* Unified solid submenu: selection changes color inside the existing row. */
#submenus::before {
  background: #151a1b;
  box-shadow: inset 1px 0 0 #82755275;
}
#submenus > .panel-edge {
  -webkit-mask-image: none;
  mask-image: none;
}
#submenus .submenu-button::before,
#submenus .submenu-button::after {
  display: none;
}
#submenus .submenu-button {
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 -1px 0 #82755235;
}
#submenus .submenu-button:hover {
  background: #ffffff08;
}
#submenus .submenu-button.active {
  background: #59201d;
  color: #ffe1a0;
  box-shadow: inset 0 1px 0 #ac895d75, inset 0 -1px 0 #ac895d75;
}

/* Parchment navigation shares the page surface and its enclosing frame. */
#submenus::before {
  background: #e7dcc7 url("/assets/backgrounds/interior.webp") center / 625px 625px repeat;
  box-shadow: none;
}
#submenus .submenu-button {
  color: #604c2b;
  text-shadow: none;
  box-shadow: inset 0 -1px 0 #80633c24;
}
#submenus .submenu-button:hover { background: #95714312; }
#submenus .submenu-button.active {
  background: #a9854c38;
  color: #45331e;
  box-shadow: inset 0 1px 0 #80633c40, inset 0 -1px 0 #80633c40;
}
body[data-preview="tablet"] .interior-window,
body[data-preview="web"] .interior-window {
  grid-column: 2 / 4;
  margin-right: calc(2.5 * var(--ui-unit));
}
body[data-preview="tablet"] .scene > #submenus,
body[data-preview="web"] .scene > #submenus {
  width: calc(100% - 4 * var(--ui-unit));
  margin-left: 0;
  margin-right: calc(4 * var(--ui-unit));
  justify-self: end;
}
.interior-open #submenus::before { background: transparent; }
.interior-open #submenus > .panel-edge { display: none; }
body[data-preview="phone"] .scene > #submenus {
  width: calc(6.6 * var(--ui-unit));
  margin-left: 0;
  justify-self: end;
}
body[data-preview="phone"] #submenus .submenu-button {
  padding-left: calc(.8 * var(--ui-unit));
  padding-right: calc(1.2 * var(--ui-unit));
}
body[data-preview="tablet"] .interior-open #submenus,
body[data-preview="web"] .interior-open #submenus {
  margin-top: calc(2.5 * var(--ui-unit) + 18px);
  height: calc(100% - 5 * var(--ui-unit) - 18px);
  max-height: calc(100% - 5 * var(--ui-unit) - 18px);
}
/* Phone icon rail matches the main graphite bar, open along its left side. */
body[data-preview="phone"] #submenus::before {
  background: #151a1b var(--stone-dark-skin,linear-gradient(#252726,#151916)) left top / auto calc(var(--visible-rows-height) * 1.08) repeat-x;
  box-shadow: none;
}
body[data-preview="phone"] #submenus > .panel-edge {
  display: block;
  left: 0;
  right: 0;
  width: auto;
}
body[data-preview="phone"] #submenus .submenu-button {
  color: #f8f1dc;
  box-shadow: inset 0 -1px 0 #82755235;
}
body[data-preview="phone"] #submenus .submenu-button.active {
  background: #59201d;
  box-shadow: inset 0 1px 0 #ac895d75, inset 0 -1px 0 #ac895d75;
}
/* Inside the phone page, only the selected icon carries the graphite bar. */
body[data-preview="phone"] .interior-open #submenus::before {
  background: transparent;
}
body[data-preview="phone"] .interior-open #submenus > .panel-edge {
  display: none;
}
body[data-preview="phone"] .interior-open #submenus .submenu-button {
  box-shadow: inset 0 -1px 0 #80633c24;
}
body[data-preview="phone"] #submenus .submenu-button.active {
  background: #151a1b var(--stone-dark-skin,linear-gradient(#252726,#151916)) left top / auto 160px repeat-x;
  box-shadow: none;
}
body[data-preview="phone"] #submenus .submenu-button.active::before,
body[data-preview="phone"] #submenus .submenu-button.active::after {
  content: '';
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  width: auto;
  height: calc(var(--bar-source-height) * .085);
  background: var(--stone-dark-skin,linear-gradient(#252726,#151916)) left bottom / auto var(--bar-source-height) repeat-x;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px #0007);
}
body[data-preview="phone"] #submenus .submenu-button.active::before {
  top: 0;
  bottom: auto;
  transform: scaleY(-1);
}
body[data-preview="phone"] #submenus .submenu-button.active::after {
  top: auto;
  bottom: 0;
  transform: none;
}
body[data-preview="phone"] #submenus .submenu-button.active {
  box-shadow: inset -1px 0 0 #9b8d64, inset -2px 0 0 #3c392c;
}
.panel-edge-side { display: none; }
/* Phone selection is plain black, fading into the page toward the left. */
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active {
  background: linear-gradient(to left, #584b3b52 0%, #584b3b38 55%, transparent 100%);
  box-shadow: inset -3px 0 0 #d5ad55;
}
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active::before,
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active::after {
  display: none;
}
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active::after {
  display: block;
  content: '';
  position: absolute;
  top: 50%;
  bottom: auto;
  left: auto;
  right: 3px;
  width: calc(.9 * var(--ui-unit));
  height: calc(1.5 * var(--ui-unit));
  transform: translateY(-50%);
  background: #d5ad55;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  filter: none;
  pointer-events: none;
}
body[data-preview="phone"] .game:not(.interior-open) #submenus > .panel-edge-side {
  display: block;
  position: absolute;
  z-index: 3;
  top: 0;
  left: calc(var(--bar-source-height) * .085);
  width: calc(var(--visible-rows-height) + var(--rail-thickness));
  height: calc(var(--bar-source-height) * .085);
  background: var(--stone-dark-skin,linear-gradient(#252726,#151916)) left bottom / auto var(--bar-source-height) repeat-x;
  transform: rotate(90deg);
  transform-origin: top left;
  filter: drop-shadow(0 2px 2px #0007);
  pointer-events: none;
}

/* Sculpted gold selection marker follows the metallic button language. */
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active {
  box-shadow: none;
}
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .activity.active > .side-selection-marker::before {
  content: '';
  display: block;
  position: absolute;
  inset: 0 0 0 auto;
  width: 4px;
  height: auto;
  transform: none;
  background: linear-gradient(to right, #43331b, #eed59a 32%, #b78c3d 58%, #65502c);
  box-shadow: -1px 0 2px #3b2c2345, inset 0 1px 0 #f2dbaa, inset 0 -1px 0 #5b401d;
  filter: none;
}
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .activity.active > .side-selection-marker::after {
  content: '';
  display: block;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 2px;
  width: calc(1.15 * var(--ui-unit));
  height: calc(1.8 * var(--ui-unit));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%23f1d99e'/%3E%3Cstop offset='.45' stop-color='%23c39a4b'/%3E%3Cstop offset='1' stop-color='%23745326'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M9 1L1 8L9 15Z' fill='url(%23g)' stroke='%23513b1d' stroke-width='1'/%3E%3Cpath d='M8.5 2L2 8L8.5 8' fill='none' stroke='%23f7e3b4' stroke-width='.65'/%3E%3Cpath d='M2 8L8.5 14' fill='none' stroke='%23886730' stroke-width='.8'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  clip-path: none;
  filter: drop-shadow(-1px 1px 1px #32221480);
}

/* Phone interior keeps notification icons in their original row slots. */
body[data-preview="phone"] .interior-open #activities {
  width: calc(6.6 * var(--ui-unit));
}
body[data-preview="phone"] .interior-open #activities::before {
  background: transparent;
}
body[data-preview="phone"] .interior-open #activities > .panel-edge {
  display: none;
}
body[data-preview="phone"] .interior-open #activities .activity > div {
  display: none;
}
body[data-preview="phone"] .interior-open #activities .activity {
  padding-left: calc(1.2 * var(--ui-unit));
  padding-right: calc(.8 * var(--ui-unit));
  min-height: 0;
}
body[data-preview="phone"] .interior-open #activities .activity:nth-child(4n + 1) { height: var(--phone-side-row-0); }
body[data-preview="phone"] .interior-open #activities .activity:nth-child(4n + 2) { height: var(--phone-side-row-1); }
body[data-preview="phone"] .interior-open #activities .activity:nth-child(4n + 3) { height: var(--phone-side-row-2); }
body[data-preview="phone"] .interior-open #activities .activity:nth-child(4n + 4) { height: var(--phone-side-row-3); }
body[data-preview="phone"] .interior-open #activities .activity + .activity::before {
  background: #80633c24;
}

/* Home restores the mirrored notification-style submenu panel. */
.game:not(.interior-open) #submenus::before {
  background: linear-gradient(to left, #142025e8 0%, #172428dc 67%, transparent 100%);
  box-shadow: none;
}
.game:not(.interior-open) #submenus > .panel-edge {
  display: block;
  -webkit-mask-image: linear-gradient(to left, #000 45%, transparent 75%);
  mask-image: linear-gradient(to left, #000 45%, transparent 75%);
  clip-path: none;
}
body[data-preview="phone"] .game:not(.interior-open) #submenus > .panel-edge-side {
  display: none;
}
body[data-preview="phone"] .game:not(.interior-open) .scene > #submenus,
body[data-preview="tablet"] .game:not(.interior-open) .scene > #submenus,
body[data-preview="web"] .game:not(.interior-open) .scene > #submenus {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.game:not(.interior-open) #submenus .submenu-button {
  color: #f8f1dc;
  text-shadow: 0 1px 2px #000a;
  box-shadow: none;
}
body[data-preview="phone"] .game:not(.interior-open) #submenus .submenu-button > div {
  display: flex;
}
.game:not(.interior-open) #submenus .submenu-button + .submenu-button::before {
  display: block;
  background: linear-gradient(to left, #a5946545 0%, #a5946530 67%, transparent 100%);
}
/* Interior phone dividers match the submenu's fine paper separators. */
body[data-preview="phone"] .interior-open .scene::before,
body[data-preview="phone"] .interior-open .scene::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #80633c24;
  z-index: 2;
  pointer-events: none;
}
body[data-preview="phone"] .interior-open .scene::before {
  left: calc(6.6 * var(--ui-unit));
}
body[data-preview="phone"] .interior-open .scene::after {
  right: calc(6.6 * var(--ui-unit));
}
/* Only clipped scroll content fades; fixed rails and dividers stay crisp. */
.panel-scroll {
  --scroll-top-alpha: #000;
  --scroll-bottom-alpha: #000;
  -webkit-mask-image: linear-gradient(to bottom, var(--scroll-top-alpha), #000 8px, #000 calc(100% - 8px), var(--scroll-bottom-alpha));
  mask-image: linear-gradient(to bottom, var(--scroll-top-alpha), #000 8px, #000 calc(100% - 8px), var(--scroll-bottom-alpha));
}
.panel-scroll[data-scroll-up] { --scroll-top-alpha: transparent; }
.panel-scroll[data-scroll-down] { --scroll-bottom-alpha: transparent; }

/* Tablet/Web share one inset paper sheet, retaining both side-panel labels. */
body:is([data-preview="tablet"], [data-preview="web"]) .interior-window {
  grid-column: 1 / -1;
  /* Equal visible gaps, compensating the frame PNG's transparent edges. */
  margin: calc(2.5 * var(--ui-unit) - 16.6px)
          calc(2.5 * var(--ui-unit) - 12.5px)
          calc(2.5 * var(--ui-unit) - 14.25px);
}
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities {
  z-index: 1;
  margin-left: calc(2.5 * var(--ui-unit));
  width: calc(100% - 2.5 * var(--ui-unit));
  clip-path: polygon(9px 0, 100% 0, 100% 100%, 9px 100%, 0 calc(100% - 9px), 0 15px);
  margin-top: calc(2.5 * var(--ui-unit) + 18px);
  height: calc(100% - 5 * var(--ui-unit) - 18px);
  max-height: calc(100% - 5 * var(--ui-unit) - 18px);
}
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #submenus { z-index: 1; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities::before { background: transparent; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities > .panel-edge { display: none; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities .activity {
  padding-left: calc(2.3 * var(--ui-unit));
  padding-right: calc(.8 * var(--ui-unit));
  color: #604c2b;
}
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities .activity > div { text-shadow: none; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities .muted { color: #80663c; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities time { color: #8b642b; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #activities .activity + .activity::before { background: #80633c24; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open .scene::before,
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open .scene::after {
  content: '';
  position: absolute;
  top: calc(2.5 * var(--ui-unit) + 18px);
  bottom: calc(2.5 * var(--ui-unit));
  width: 1px;
  background: #80633c24;
  z-index: 2;
  pointer-events: none;
}
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open .scene::before { left: calc(25 * var(--ui-unit)); }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open .scene::after { right: calc(25 * var(--ui-unit)); }

/* Tablet/Web keep the same side-list anchors on the city and paper views. */
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #activities {
  margin-left: calc(4 * var(--ui-unit));
  width: calc(100% - 4 * var(--ui-unit));
  margin-top: calc(2.5 * var(--ui-unit) + 18px);
  height: calc(100% - 5 * var(--ui-unit) - 18px);
  max-height: calc(100% - 5 * var(--ui-unit) - 18px);
}
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #activities .activity {
  padding-left: calc(.8 * var(--ui-unit));
  padding-right: calc(.8 * var(--ui-unit));
}
body:is([data-preview="tablet"], [data-preview="web"]) .scene > #submenus {
  width: calc(100% - 2.5 * var(--ui-unit));
  margin-right: calc(2.5 * var(--ui-unit));
  margin-left: 0;
  margin-top: calc(2.5 * var(--ui-unit) + 18px);
  height: calc(100% - 5 * var(--ui-unit) - 18px);
  max-height: calc(100% - 5 * var(--ui-unit) - 18px);
}
body:is([data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button {
  justify-content: flex-start;
  text-align: left;
  padding-left: calc(.8 * var(--ui-unit));
  padding-right: calc(.8 * var(--ui-unit));
  gap: calc(.6 * var(--ui-unit));
  font-weight: 400;
  font-size: 1em;
  text-shadow: none;
}
body:is([data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button > .icon { order: -1; }
body:is([data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button > div {
  align-items: flex-start;
  line-height: 1.18;
}
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #submenus .submenu-button { color: #604c2b; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #submenus .submenu-button > div { text-shadow: none; }
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) .scene > #submenus {
  width: calc(100% - 2.5 * var(--ui-unit));
  margin-right: calc(2.5 * var(--ui-unit));
  margin-left: 0;
}

/* Close the upper paper corners beneath the frame; preserve lower corners. */
body:is([data-preview="tablet"], [data-preview="web"]) .interior-window::before {
  top: 31px;
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 4px);
}
/* Tablet/Web have crisp panel surfaces and scrolling edges. */
body:is([data-preview="tablet"], [data-preview="web"]) .panel-scroll,
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) .panel-edge {
  -webkit-mask-image: none;
  mask-image: none;
}
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #activities::before,
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #submenus::before {
  background: #142025d9;
  -webkit-mask-image: none;
  mask-image: none;
}
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) .activity + .activity::before { background: #a5946530; }
body:is([data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active { background: #584b3b30; }
/* The marker touches the inside of the gold rail, with both corners clipped. */
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open #submenus {
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 15px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
}
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open .activity.active > .side-selection-marker::before { right: 2px; }
body:is([data-preview="tablet"], [data-preview="web"]) .interior-open .activity.active > .side-selection-marker::after { right: 4px; }

/* Submenus require an active parent menu in every preview. */
#submenus[hidden] { display: none !important; }
/* Restore the approved inward notification fade on Tablet/Web city view. */
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #activities::before {
  background: linear-gradient(to right, #142025e8 0%, #172428dc 67%, transparent 100%);
}
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #activities > .panel-edge {
  -webkit-mask-image: linear-gradient(to right, #000 45%, transparent 75%);
  mask-image: linear-gradient(to right, #000 45%, transparent 75%);
}
body:is([data-preview="tablet"], [data-preview="web"]) .game:not(.interior-open) #activities .activity + .activity::before {
  background: linear-gradient(to right, #a5946545 0%, #a5946530 67%, transparent 100%);
}


/* Approved profile: short reversed health/energy gauges left of portrait. */
.profile {
  width: calc(38.5 * var(--ui-unit)); flex-basis: calc(38.5 * var(--ui-unit));
  height: calc(15.1 * var(--ui-unit)); top: calc(-2.3 * var(--ui-unit));
  background-image: none;
}
.profile-info > strong {
  left: 54%; top: 26%; width: 40%; height: 14%;
  font-size: calc(2.05 * var(--ui-unit));
}
.profile .progress-row { transform: none; }
.profile .level {
  left: 44.5%; top: 45%; width: 9.2%; height: 24%;
  display: grid; place-items: center; font-size: calc(1.95 * var(--ui-unit));
}
.profile .xp {
  left: 54%; top: 49%; width: 36.5%; height: 11.2%;
  overflow: hidden; border-radius: 2px; padding: 0; margin: 0;
}
.profile .xp-fill {
  display: block; inset: 0 auto 0 0; width: 49.8%; border-radius: 1px;
  background: linear-gradient(#ffe991,#e6b83e 45%,#a97913);
  box-shadow: inset 0 1px 1px #fff3,inset 0 -1px 1px #513205;
}
.profile .xp-value { z-index: 1; font-size: calc(1.35 * var(--ui-unit)); padding: 0; }
.profile-meter { position: absolute; overflow: hidden; border-radius: 1px; }
.profile-health { left: 6%; top: 31%; width: 19.6%; height: 9.4%; }
.profile-energy { left: 6%; top: 49%; width: 20.5%; height: 11.2%; }
.meter-fill {
  position: absolute; inset: 0 0 0 auto; width: var(--stat-percent,100%);
  transition: width .25s ease;
}
.profile-health .meter-fill { background: linear-gradient(#f37161,#cd2c23 45%,#790b09); }
.profile-energy .meter-fill { background: linear-gradient(#88d8ff,#288fd6 45%,#10527e); }
.meter-value {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff1d6; font: calc(1.1 * var(--ui-unit)) / 1 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: 0 1px 1px #000;
}
/* All liquid layers sit behind the artwork, whose gauge apertures have alpha. */
body[data-preview="phone"] .profile,
body[data-preview="tablet"] .profile,
body[data-preview="web"] .profile { left: calc(.15 * var(--ui-unit)); }
.profile { background-image: none; }
.profile::before {
  content: ''; position: absolute; inset: 0; z-index: 3;
  background: none center / 100% 100% no-repeat;
  pointer-events: none;
}
.profile-info { z-index: auto; }
.profile-info > strong, .profile .level { z-index: 4; }
.profile .xp, .profile-meter { z-index: 1; background: linear-gradient(#252722,#0b1110); }
.profile .xp { left: 53%; top: 48%; width: 39.4%; height: 13%; border-radius: 0; clip-path: polygon(0 0,95% 0,100% 22%,100% 78%,95% 100%,0 100%); }
.profile .xp-fill { border-radius: 0; }
.profile-health { left: 5.8%; top: 30.5%; width: 20.5%; height: 10%; clip-path: polygon(5% 0,100% 0,100% 100%,5% 100%,0 80%,0 20%); }
.profile-energy { left: 5.8%; top: 48.7%; width: 21.5%; height: 11.7%; clip-path: polygon(5% 0,100% 0,100% 100%,5% 100%,0 80%,0 20%); }
.profile .xp-value, .meter-value { z-index: 4; }
/* Larger meter values and optically raised level label. */
.profile .xp-value { font-size: calc(1.55 * var(--ui-unit)); }
.meter-value { font-size: calc(1.3 * var(--ui-unit)); }
.profile .level { transform: translateY(calc(-.35 * var(--ui-unit))); }
/* Match optical vertical centers in each gauge opening. */
.profile .xp-value, .meter-value {
  display: flex; align-items: center; justify-content: center;
  line-height: 1; transform: translateY(calc(-.12 * var(--ui-unit)));
  font-family: 'Segoe UI', sans-serif; font-weight: 400;
}
.profile .xp-value { font-size: calc(1.65 * var(--ui-unit)); }
.meter-value { font-size: calc(1.4 * var(--ui-unit)); }
/* Short percentage gauges, single gold rims and full liquid apertures. */
.profile-health { left: 11.4%; top: 27%; width: 14.9%; height: 14%; }
.profile-energy { left: 11.4%; top: 46%; width: 15.9%; height: 14%; }
.profile .xp { left: 51.5%; top: 46%; width: 39.7%; height: 14%; }
/* Smooth crimson name banner with no fabric left of portrait. */
.profile-health { left: 7%; top: 28%; width: 16.7%; height: 14%; }
.profile-energy { left: 7%; top: 48%; width: 16.7%; height: 13.5%; }
.profile .xp { left: 49.5%; top: 48%; width: 41.6%; height: 13.5%; }
.profile .level { left: 41%; top: 47%; }
/* Restore matte original plaque materials and finely painted portrait. */
.profile-health { left: 5.5%; top: 29.5%; width: 16%; height: 13%; }
.profile-energy { left: 5.5%; top: 49.5%; width: 16.5%; height: 13%; }
.profile .xp { left: 48%; top: 49.5%; width: 42.8%; height: 13%; }
.profile .level { left: 40%; top: 47%; }

/* Optical centering of level within the matte profile medallion. */
.profile .level { left: 39.6%; }
/* Side dividers stop at occupied rows; selection is confined to its row. */
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .interior-open .scene::before,
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .interior-open .scene::after { display: none; }
.side-divider, .side-selection { position: absolute; pointer-events: none; }
.side-divider { width: 1px; background: #80633c24; z-index: 3; }
.side-selection { z-index: 1; }
.side-selection.side-submenus { background: linear-gradient(to left, #584b3b52 0%, #584b3b38 55%, transparent 100%); }
.side-selection.side-mini-menus { background: linear-gradient(to left, #584b3b52 0%, #584b3b38 55%, transparent 100%); }
.side-selection.side-activities { background: linear-gradient(to right, #584b3b52 0%, #584b3b38 55%, transparent 100%); }
.side-divider[hidden], .side-selection[hidden] { display: none; }
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .interior-open #activities,
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .interior-open #submenus { z-index: 2; }
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .interior-open #submenus .submenu-button.active,
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .interior-open #activities .activity.active { background: transparent; }
#activities .activity[role="button"] { cursor: pointer; }
#activities .activity[role="button"]:focus-visible { outline: 1px solid #af8f50; outline-offset: -2px; }
.game:not(.interior-open) #activities .activity.active { background: linear-gradient(to right,#a9854c38,transparent); }
/* One shared gold marker; notifications mirror the submenu marker. */
.side-selection-marker { position: absolute; inset: 0; pointer-events: none; }
#activities .side-selection-marker { transform: scaleX(-1); }
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active::before,
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) #submenus .submenu-button.active::after { display: none; }
/* Imperial selection 06 from the twenty-option crimson comparison sheet. */
.game[data-red-style="imperial-06"] .menu-button.active {
  background: none;
  box-shadow: none;
}
.game[data-red-style="imperial-06"] .menu-button.active::before {
  content: ''; display: block; inset: 0; border: 0; border-radius: 0;
  background: url("/assets/ui/navigation-selected.webp") center / 103% 127% no-repeat;
  opacity: 1; filter: none; box-shadow: none;
}
/* Compact character artwork beside the notifications, in the character page only. */
.empty-window { position: relative; }
.character-preview {
  position: absolute; margin: 0; left: calc(7.6 * var(--ui-unit)); top: calc(2 * var(--ui-unit));
  width: calc(26 * var(--ui-unit)); height: calc(25 * var(--ui-unit));
  max-width: calc(100% - 15.2 * var(--ui-unit)); max-height: calc(100% - 4 * var(--ui-unit));
  pointer-events: none;
}
.character-preview[hidden] { display: none; }
.character-preview img { width: 100%; height: 100%; display: block; object-fit: contain; }
body:is([data-preview="tablet"], [data-preview="web"]) .character-preview {
  left: calc(25 * var(--ui-unit)); top: calc(4.8 * var(--ui-unit));
  max-width: calc(100% - 50 * var(--ui-unit));
}
/* Submenu-owned mini menus sit immediately inside the existing right rail. */
.mini-menus {
  position: absolute; z-index: 2; width: calc(6.6 * var(--ui-unit));
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.mini-menus[hidden], body:is([data-preview="tablet"], [data-preview="web"]) .mini-menus { display: none; }
.mini-menus .panel-scroll {
  flex-shrink: 1;
  scroll-snap-type: y mandatory;
}
.mini-menu-button {
  width: 100%; min-height: 0; flex-shrink: 0; justify-content: center;
  padding: 0; border: 0; border-radius: 0; color: #604c2b;
  background: transparent; text-shadow: none; cursor: pointer;
  box-shadow: inset 0 -1px 0 #80633c24;
  scroll-snap-align: start;
}
.mini-menu-button .mini-menu-label { font-size: calc(1.9 * var(--ui-unit)); line-height: 1; }
.mini-menu-button + .mini-menu-button::before { background: #80633c24; }
.mini-menu-button:hover { background: #95714312; }
.interior-open #mini-menus .mini-menu-button.active { background: transparent; }
body:is([data-preview="phone"], [data-preview="tablet"], [data-preview="web"]) .mini-menu-button.active > .side-selection-marker::before { display: none; }
/* Model 07 preview: slim gold rails and diamond, with separate HTML numerals. */
body[data-preview="phone"] .mini-menu-button.active > .side-selection-marker {
  background: url("/assets/ui/submenu-mini-selected.webp") center / 100% 100% no-repeat;
}
body[data-preview="phone"] .mini-menu-button.active > .side-selection-marker::after { display: none; }
.mini-menu-button:focus-visible { outline: 1px solid #af8f50; outline-offset: -2px; }
/* Nine equal square empty equipment slots beside the character. */
.equipment-grid {
  position: absolute; left: calc(34 * var(--ui-unit)); top: calc(1.1 * var(--ui-unit));
  height: calc(100% - 2.2 * var(--ui-unit)); max-height: calc(28 * var(--ui-unit));
  aspect-ratio: 1; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: calc(.55 * var(--ui-unit));
}
.equipment-grid[hidden] { display: none; }
.equipment-slot {
  aspect-ratio: 1; min-width: 0; min-height: 0;
  display: grid; place-items: center;
  background: none var(--equipment-x) var(--equipment-y) / 334.4% 344.5% no-repeat;
}
body:is([data-preview="tablet"], [data-preview="web"]) .equipment-grid {
  left: calc(52 * var(--ui-unit)); top: calc(4.8 * var(--ui-unit));
  height: calc(28 * var(--ui-unit)); max-height: calc(100% - 8 * var(--ui-unit));
}
/* Approved one-piece Phone Character I illustration. Tablet/Web retain their own layout. */
.phone-equipment { display: none; }
body[data-preview="phone"] .phone-equipment:not([hidden]) {
  position: absolute; inset: 0; display: block; pointer-events: none;
}
body[data-preview="phone"] .phone-equipment-art {
  display: block; width: 100%; height: 100%;
  /* Fade follows the SVG drawing bounds, including its letterboxing. */
}
body[data-preview="phone"] .phone-stone-equipment .empty-window { padding: 0; }

/* Phone only: clean stone/bar joins and a cracked graphite header center. */
body[data-preview="phone"] .topbar,
body[data-preview="phone"] .bottom-nav { box-shadow: none; }
body[data-preview="phone"] .topbar::after {
  content: ''; display: block; position: absolute;
  top: 2px; bottom: 5px; left: 38%; right: 34%;
  width: auto; height: auto; border: 0; box-shadow: none;
  background: none center / cover no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
  opacity: .9; z-index: 0; pointer-events: none; filter: none; transform: none;
}
body[data-preview="phone"] .topbar .resources { position: relative; z-index: 1; }

/* Keep the character opaque and flush against the bottom rail. */
body[data-preview="phone"] .phone-equipment-hero {
  position: absolute; display: block; bottom: 0; left: 50%;
  height: 98%; width: auto; max-width: 31%;
  object-fit: contain; object-position: center bottom; transform: translateX(-50%);
  z-index: 1; pointer-events: none;
}
/* Subpixel dust stays in the hero area, away from the live menus. */
.phone-equipment-dust { display: none; }
body[data-preview="phone"] .phone-equipment:not([hidden]) > .phone-equipment-dust {
  display: block;
  position: absolute;
  inset: 4% 35% 4%;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}
body[data-preview="phone"] .phone-equipment-dust > span {
  position: absolute;
  left: var(--dust-x);
  top: var(--dust-y);
  width: calc(var(--dust-size) * var(--ui-unit));
  height: calc(var(--dust-size) * var(--ui-unit));
  border-radius: 50%;
  background: #a9926d;
  opacity: 0;
  animation: phone-equipment-dust-drift var(--dust-duration) linear var(--dust-delay) infinite;
}
@keyframes phone-equipment-dust-drift {
  0% {
    opacity: 0;
    transform: translate(0, 0);
  }
  18% {
    opacity: .05;
    transform: translate(calc(var(--dust-dx) * .2 * var(--ui-unit)), calc(var(--dust-dy) * .12 * var(--ui-unit)));
  }
  47% {
    opacity: var(--dust-alpha);
    transform: translate(calc(var(--dust-dx) * .85 * var(--ui-unit)), calc(var(--dust-dy) * .45 * var(--ui-unit)));
  }
  76% {
    opacity: .06;
    transform: translate(calc(var(--dust-dx) * .6 * var(--ui-unit)), calc(var(--dust-dy) * .8 * var(--ui-unit)));
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dust-dx) * var(--ui-unit)), calc(var(--dust-dy) * var(--ui-unit)));
  }
}
/* Honor the app's existing .reduce-motion ancestor. Hide particles entirely. */
.reduce-motion .phone-equipment-dust { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  body[data-preview="phone"] .phone-equipment-dust { display: none !important; }
}

/* Phone equipment shadows follow the two transparent bank contours. */
body[data-preview="phone"] .phone-equipment-art > image {
  filter: url("#phone-equipment-contour") drop-shadow(3px 5px 4px #4b3c2659);
}
/* Phone sidebars: accepted painted v8 slabs, same scale on both sides. */
.phone-stone-decoration { display: none; }
body[data-preview="phone"] .interior-open .scene::before,
body[data-preview="phone"] .interior-open .scene::after {
  content:'';display:block;position:absolute;top:0;bottom:0;
  width:calc(10.2 * var(--ui-unit));height:auto;
  background-color:transparent;
  background-size:100% calc(30.35 * var(--ui-unit));
  background-position:top;
  background-repeat:repeat-y;
  background-blend-mode:normal;
  mask-image:none;transform:none;filter:none;z-index:1;pointer-events:none;
}
body[data-preview="phone"] .interior-open .scene::before {left:0;right:auto;background-image:none;}
body[data-preview="phone"] .interior-open .scene::after {right:0;left:auto;background-image:none;}
/* User removed the painted sidebar slabs; retain the existing icon controls. */
body[data-preview="phone"] .interior-open .scene::before,
body[data-preview="phone"] .interior-open .scene::after {content:none;display:none;background:none;}
body[data-preview="phone"] .interior-open .side-selection:is(.side-activities,.side-submenus),
body[data-preview="phone"] .interior-open .side-divider:is(.side-activities,.side-submenus) {display:none;}
body[data-preview="phone"] .interior-open #activities,
body[data-preview="phone"] .interior-open #submenus {z-index:3;}
body[data-preview="phone"] .interior-open #activities .activity,
body[data-preview="phone"] .interior-open #submenus .submenu-button {
  isolation:isolate;background:transparent;box-shadow:none;
}
body[data-preview="phone"] .interior-open #activities .activity::after,
body[data-preview="phone"] .interior-open #submenus .submenu-button::after {
  content:'';display:block;position:absolute;
  top:calc(.24 * var(--ui-unit));bottom:calc(.24 * var(--ui-unit));
  width:auto;height:auto;margin:0;max-width:none;max-height:none;
  box-sizing:border-box;border:calc(.9 * var(--ui-unit)) solid transparent;
  border-image:none 70 fill / 1 stretch;
  border-radius:0;background:none;box-shadow:none;filter:none;opacity:1;
  transform:none;clip-path:none;z-index:-1;pointer-events:none;
}
body[data-preview="phone"] .interior-open #activities .activity::after {left:calc(.28 * var(--ui-unit));right:calc(.73 * var(--ui-unit));}
body[data-preview="phone"] .interior-open #submenus .submenu-button::after {left:calc(.73 * var(--ui-unit));right:calc(.28 * var(--ui-unit));}
body[data-preview="phone"] .interior-open #activities .activity + .activity::before {display:none;}
body[data-preview="phone"] .interior-open #activities .activity.active::after,
body[data-preview="phone"] .interior-open #submenus .submenu-button.active::after {filter:brightness(.94) saturate(1.08);}
body[data-preview="phone"] .interior-open #activities .activity:hover::after,
body[data-preview="phone"] .interior-open #submenus .submenu-button:hover::after {filter:brightness(1.035);}
body[data-preview="phone"] .interior-open .phone-stone-decoration {
  display:none;
}
body[data-preview="phone"] .interior-open .phone-stone-decoration.left {left:calc(5.1 * var(--ui-unit));}
body[data-preview="phone"] .interior-open .phone-stone-decoration.right {right:calc(5.1 * var(--ui-unit));}
.phone-stone-decoration .edge {
  position:absolute;inset:0;background-size:100% calc(5.5 * var(--ui-unit)),100% calc(5.5 * var(--ui-unit)),100% calc(17.5 * var(--ui-unit));
  background-repeat:no-repeat,no-repeat,repeat-y;background-position:top,bottom,top;
}
.phone-stone-decoration.left .edge {
  background-image:none,none,none;
  mask-image:none;
  filter:drop-shadow(1px 0 1.5px #594c3240);
}
.phone-stone-decoration.right .edge {
  background-image:none,none,none;
  mask-image:none;
  filter:drop-shadow(-1px 0 1.5px #594c3240);
}

/* Exterior charcoal material, confined to the interior icon rails. */
body[data-preview="phone"] .interior-open #activities::before,
body[data-preview="phone"] .interior-open #submenus::before {
  content:'';display:block;z-index:-1;top:0;bottom:auto;
  height:var(--visible-rows-height,0px);width:100%;
  mask-image:none;-webkit-mask-image:none;box-shadow:none;
}
body[data-preview="phone"] .interior-open #activities::before {
  background:linear-gradient(to right,#142025e8 0%,#172428dc calc(100% - 8px),transparent 100%);
}
body[data-preview="phone"] .interior-open #submenus::before {
  background:linear-gradient(to left,#142025e8 0%,#172428dc calc(100% - 8px),transparent 100%);
}
body[data-preview="phone"] .interior-open #activities .activity::after,
body[data-preview="phone"] .interior-open #submenus .submenu-button::after {display:none;content:none;}
body[data-preview="phone"] .interior-open #activities > .panel-edge,
body[data-preview="phone"] .interior-open #submenus > .panel-edge {display:block;width:100%;left:0;right:0;}
body[data-preview="phone"] .interior-open #activities > .panel-edge {
  mask-image:linear-gradient(to right,#000 calc(100% - 8px),transparent 100%);
  -webkit-mask-image:linear-gradient(to right,#000 calc(100% - 8px),transparent 100%);
}
body[data-preview="phone"] .interior-open #submenus > .panel-edge {
  mask-image:linear-gradient(to left,#000 calc(100% - 8px),transparent 100%);
  -webkit-mask-image:linear-gradient(to left,#000 calc(100% - 8px),transparent 100%);
}
body[data-preview="phone"] .interior-open #activities .activity + .activity::before,
body[data-preview="phone"] .interior-open #submenus .submenu-button + .submenu-button::before {
  display:block;background:#a5946530;
}

/* Inside Phone menus, retain only icons and the existing gold selection marker. */
/* 2.5D preview: separate hero and environment planes, feet stay anchored. */
body[data-preview="phone"] .phone-equipment-hero.gladiator-rig {
  animation:none;
  transform:translateX(calc(-50% + var(--hero-parallax-x,0px))) translateY(var(--hero-parallax-y,0px));
  overflow:visible;
}
.gladiator-rig g {transform-box:view-box;}
.rig-breath {transform-origin:50% 100%;animation:rig-breathe 4.6s ease-in-out infinite;}
.rig-sword-motion {transform-origin:23% 75%;animation:rig-sword-idle 5.3s ease-in-out infinite;}
.rig-shield-motion {transform-origin:79% 62%;animation:rig-shield-idle 4.1s ease-in-out infinite;}
.rig-hair-motion {transform-origin:48% 10%;animation:rig-hair-idle 3.4s ease-in-out infinite;}
@keyframes rig-breathe {0%,100%{transform:scale(1)}50%{transform:scale(1.005,1.012)}}
@keyframes rig-sword-idle {0%,100%{transform:rotate(-.8deg)}50%{transform:rotate(1.1deg)}}
@keyframes rig-shield-idle {0%,100%{transform:rotate(.7deg) scaleX(1)}50%{transform:rotate(-1deg) scaleX(.985)}}
@keyframes rig-hair-idle {0%,100%{transform:skewX(-.5deg) scale(1.003)}50%{transform:skewX(.7deg) scale(1.006)}}
.reduce-motion .gladiator-rig g {animation:none!important;transform:none!important;}
@media(prefers-reduced-motion:reduce){.gladiator-rig g{animation:none!important;transform:none!important;}}
body[data-preview="phone"] .phone-equipment-hero {
  transform-origin:50% 100%;
  animation:gladiator-idle-breath 4.6s ease-in-out infinite;
  will-change:transform;
  filter:drop-shadow(0 3px 3px #211a2245);
}
@keyframes gladiator-idle-breath {
  0%,100% {transform:translateX(calc(-50% + var(--hero-parallax-x,0px))) translateY(var(--hero-parallax-y,0px)) rotate(-.22deg) scale(1,1);}
  48% {transform:translateX(calc(-50% + var(--hero-parallax-x,0px))) translateY(var(--hero-parallax-y,0px)) rotate(.22deg) scale(1.012,1.02);}
}
body[data-preview="phone"] .interior-window.phone-stone-equipment {
  background-position:calc(50% + var(--ruins-parallax-x,0px)) calc(50% + var(--ruins-parallax-y,0px));
}
.reduce-motion .phone-equipment-hero {animation:none!important;transform:translateX(-50%)!important;}
@media(prefers-reduced-motion:reduce) {
  body[data-preview="phone"] .phone-equipment-hero {animation:none;transform:translateX(-50%);will-change:auto;}
}
body[data-preview="phone"] .interior-window.phone-stone-equipment {
  background-image:none !important;
  background-size:cover;background-position:calc(50% + var(--ruins-parallax-x,0px)) calc(50% + var(--ruins-parallax-y,0px));background-repeat:no-repeat;
}
body[data-preview="phone"] .interior-open #activities::before,
body[data-preview="phone"] .interior-open #submenus::before,
body[data-preview="phone"] .interior-open #activities > .panel-edge,
body[data-preview="phone"] .interior-open #submenus > .panel-edge,
body[data-preview="phone"] .interior-open #submenus > .panel-edge-side,
body[data-preview="phone"] .interior-open #activities .activity + .activity::before,
body[data-preview="phone"] .interior-open #submenus .submenu-button + .submenu-button::before {
  display:none;content:none;background:none;box-shadow:none;
}
body[data-preview="phone"] .interior-open #activities .activity,
body[data-preview="phone"] .interior-open #submenus .submenu-button {
  background:transparent;box-shadow:none;
}
