* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    cursor: default;
}

body {
    background: #000;
    font-family: Arial, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.site-ribbon {
    position: fixed;
    top: 0;
    left: 30px;
    /* Above .tab-panels (997); same as .nav-block (998) but earlier in DOM so nav paints on top */
    z-index: 998;
    max-height: min(115px, 19vh);
    width: auto;
    max-width: min(calc(100vw - 30px), 1152px);
    height: auto;
    pointer-events: none;
    object-fit: contain;
    object-position: left top;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.12));
}

.nav-block {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 40px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.nav-block-slider {
    position: absolute;
    top: 5px;
    left: 0;
    width: 0;
    height: 30px;
    background: #ffcc00;
    border-radius: 7.5px;
    pointer-events: none;
    z-index: 0;
    transition: left 0.25s ease-out, width 0.25s ease-out;
}

.nav-block-item {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 24px;
    color: #333333;
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

.nav-block-item:hover {
    color: #000000;
}

.nav-block-item.active {
    color: #000000;
}

.nav-block-item:not(:last-child) {
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-block-item[hidden] {
    display: none !important;
}

.nav-block-item--app-detail {
    max-width: 11rem;
    padding: 0 16px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-block--app-detail .nav-block-item[data-tab="app"] {
    color: #555;
}

.nav-block--app-detail .nav-block-item--app-detail.active {
    color: #000;
}

/* Home: scene hamburger + controls panel + mute (same band as .nav-block) */
.home-top-controls {
    position: fixed;
    top: 40px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

/* Home only: mute / unmute boing + bullet SFX (SoundManager default muted) */
.home-sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 10px;
    color: #333;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.home-sound-toggle:hover {
    background: #f5f5f5;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.22);
}

.home-sound-toggle.home-sound-toggle--on {
    color: #fff;
    background: linear-gradient(180deg, #2ecc71 0%, #1e9c55 100%);
    box-shadow: 0 2px 10px rgba(30, 156, 85, 0.35);
}

.home-sound-toggle.home-sound-toggle--on:hover {
    background: linear-gradient(180deg, #3ddb82 0%, #27b564 100%);
}

.home-sound-toggle__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.home-sound-toggle__svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.home-sound-toggle__svg--on {
    display: none;
}

.home-sound-toggle--on .home-sound-toggle__svg--muted {
    display: none;
}

.home-sound-toggle--on .home-sound-toggle__svg--on {
    display: block;
}

.home-sound-toggle:focus-visible {
    outline: 3px solid #1a5f3a;
    outline-offset: 3px;
}

/* Full-width sheet below fixed nav (nav: top 40px + height 40px) */
.tab-panels {
    --sheet-gap: 22px;
    position: fixed;
    top: calc(40px + 40px + 10px);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 997;
    pointer-events: none;
    overflow: hidden;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
}

.tab-panels.tab-panels--visible {
    pointer-events: auto;
}

/* All sheets in one row with a visible gap; JS translates by (panel width + gap) per step */
.tab-panels-track {
    --panel-slot: 100vw;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    height: 100%;
    width: max-content;
    will-change: transform;
    /* Whole deck off to the right until JS positions a tab */
    transform: translateX(100%);
    transition: transform 0.92s cubic-bezier(0.68, 0, 0.16, 1);
}

.tab-panel {
    flex: 0 0 var(--panel-slot);
    min-width: 0;
    height: 100%;
    background: #eeeeee;
    border-radius: 0;
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Opaque black strip in the gap between sheets (no canvas bleed during transitions) */
.sheet-gap-rule {
    flex: 0 0 var(--sheet-gap);
    width: var(--sheet-gap);
    min-width: var(--sheet-gap);
    align-self: stretch;
    flex-shrink: 0;
    background: #000;
    pointer-events: none;
}

.tab-panel-title {
    margin: 0 0 16px;
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    align-self: stretch;
    text-align: left;
    flex-shrink: 0;
}

/* Only hide system cursor when Soldier (target cursor) is active */
html.cursor-hidden,
html.cursor-hidden *,
body.cursor-hidden,
body.cursor-hidden * {
    cursor: none !important;
}

.custom-cursor {
    position: fixed;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 99999;
    overflow: visible;
}

.custom-cursor img {
    display: block;
    transform-origin: top left;
}

.canvas-container {
    position: relative;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
}

.canvas-container canvas {
    display: block;
}

body.cursor-hidden .canvas-container canvas {
    cursor: none !important;
}

body.apps-tab-active .home-top-controls {
    display: none !important;
}

#menuToggle {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 5px;
    flex-shrink: 0;
}

.home-top-controls #menuToggle {
    position: static;
    top: auto;
    right: auto;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    padding: 10px 8px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.home-top-controls #menuToggle:hover {
    background: #f5f5f5;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.22);
}

#menuToggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: #fff;
    border-radius: 3px;
    flex-shrink: 0;
    transform-origin: center center;
    transition: transform 0.3s ease, opacity 0.25s ease;
}

.home-top-controls #menuToggle span {
    background: #333;
}

/* Three bars 3px + gap 5px: outer bar centers are 8px from the middle bar — slide + rotate into a centered X */
#menuToggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

#menuToggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#menuToggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

#controlsPanel {
    position: absolute;
    top: 50px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 8px;
    min-width: 300px;
    width: auto;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    z-index: 999;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.home-top-controls #controlsPanel {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    max-height: min(72vh, calc(100vh - 96px));
    z-index: 1001;
}

#controlsPanel .home-sound-toggle--panel {
    width: 100%;
    height: 42px;
    margin: 0 0 16px;
    padding: 0 10px;
    border-radius: 8px;
    justify-content: flex-start;
    gap: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: none;
}

#controlsPanel .home-sound-toggle--panel:hover {
    background: rgba(255, 255, 255, 0.22);
    box-shadow: none;
}

#controlsPanel .home-sound-toggle--panel.home-sound-toggle--on {
    background: rgba(46, 204, 113, 0.3);
    color: #eafff2;
    box-shadow: none;
}

.home-sound-toggle__text {
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.02em;
}

#controlsPanel.active {
    display: block;
}

.controls-collapsible {
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    overflow: clip;
}

.controls-collapsible:last-of-type {
    margin-bottom: 0;
}

.controls-collapsible__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.controls-collapsible__summary::-webkit-details-marker {
    display: none;
}

.controls-collapsible__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffcc00;
}

.controls-collapsible__label::before {
    content: '▸';
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    transition: transform 0.18s ease;
}

.controls-collapsible[open] .controls-collapsible__label::before {
    transform: rotate(90deg);
}

.controls-collapsible__body {
    padding: 0 12px 12px;
}

.controls-collapsible__body--inactive {
    opacity: 0.45;
    pointer-events: none;
}

.controls-collapsible--visible-on .controls-collapsible__summary {
    border-left: 3px solid rgba(255, 204, 0, 0.75);
}

.controls-visible-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: normal;
    letter-spacing: 0;
    text-transform: none;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
}

.controls-visible-toggle input {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
}

.controls-subsection {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.controls-subsection:last-child {
    margin-bottom: 0;
}

.controls-subsection__title {
    margin: 0 0 10px;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.controls-section__hint {
    margin: 0;
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.controls-section__hint kbd {
    display: inline-block;
    min-width: 1.25em;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.35);
    font-family: inherit;
    font-size: 11px;
    text-align: center;
}

.control-group {
    margin-bottom: 12px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    color: #fff;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.control-group input[type="number"] {
    width: 80px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    font-family: 'Courier New', monospace;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-row--color {
    justify-content: flex-start;
}

.control-row--color input[type="color"] {
    width: 48px;
    height: 32px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.control-group label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

#resetButton {
    width: 100%;
    padding: 10px;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

#resetButton:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Legacy drawer styles (unused by tabbed panel flow) */
.top-panels {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    flex-direction: column;
    align-items: stretch;
    pointer-events: none;
}

.top-panels * {
    pointer-events: auto;
}

/* Toybox: full-width tab row; top variant (in .top-panels) or bottom variant (.toybox-bottom) */
.toybox {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 44px;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    pointer-events: none;
    transition: max-height 0.3s ease-in-out;
}

.toybox.open {
    max-height: 80vh;
}

/* Toybox at bottom of screen: fixed, panel slides up (hidden for now) */
.toybox-bottom {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 1000;
}

.toybox * {
    pointer-events: auto;
}

.toybox-drawer {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
    flex-shrink: 0;
    min-height: min-content;
    transform: translateY(calc(-100% + 44px));
    transition: transform 0.3s ease-in-out;
}

.toybox.open .toybox-drawer {
    transform: translateY(0);
}

.toybox-handle {
    position: relative;
    z-index: 10;
    height: 44px;
    min-height: 44px;
    width: 100%;
    background: #666666;
    border: none;
    border-bottom: 1px solid #fff;
    cursor: pointer;
    padding: 0 12px;
    flex-shrink: 0;
    transition: background 0.2s;
    pointer-events: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.toybox-bottom .toybox-handle {
    border-bottom: none;
    border-top: 1px solid #fff;
    border-radius: 10px 10px 0 0;
}

.toybox-handle:hover {
    background: #CCCCCC;
}

.toybox-handle:hover .toybox-handle-arrow,
.toybox-handle:hover .toybox-handle-label {
    color: #333;
}

.toybox-handle-arrow {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
    transition: transform 0.2s ease;
    transform: rotate(90deg);  /* point down when closed */
}

.toybox.open .toybox-handle-arrow {
    transform: rotate(-90deg);  /* point up when open */
}

.toybox-bottom .toybox-handle-arrow {
    transform: rotate(-90deg);  /* point up when closed (expand upward) */
}

.toybox-bottom.open .toybox-handle-arrow {
    transform: rotate(90deg);   /* point down when open (collapse) */
}

.toybox-handle-label {
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.95);
    user-select: none;
}

.toybox-panel {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: calc(80vh - 44px);
    flex-shrink: 0;
    background: #eeeeee;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.toybox-bottom .toybox-panel {
    border-bottom: none;
    border-top: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.toybox.open .toybox-handle {
    background: #CCCCCC;
}

.toybox.open .toybox-handle-arrow,
.toybox.open .toybox-handle-label {
    color: #333;
}

.toybox-toys {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    align-content: flex-start;
    padding: 4px 0;
}

.toy-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 80px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 18px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s ease;
    flex-shrink: 0;
}

.toy-item:hover {
    transform: scale(1.05);
}

.toy-item .toy-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: linear-gradient(145deg, #c8c8c8 0%, #a0a0a0 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: block;
}

.toy-item .toy-title {
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toy-item.active {
    border-color: #666;
    animation: toy-pulse 1.5s ease-in-out infinite;
}

@keyframes toy-pulse {
    0%, 100% { border-color: #666; box-shadow: 0 0 0 0 rgba(102, 102, 102, 0.4); }
    50%      { border-color: #333; box-shadow: 0 0 0 6px rgba(102, 102, 102, 0.15); }
}

/* Applications content inside tab panel */
.applications {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 44px;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    pointer-events: none;
    transition: max-height 0.3s ease-in-out;
}

.applications.open {
    max-height: 80vh;
}

.applications * {
    pointer-events: auto;
}

.applications-drawer {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
    flex-shrink: 0;
    min-height: min-content;
    transform: translateY(calc(-100% + 44px));
    transition: transform 0.3s ease-in-out;
}

.applications.open .applications-drawer {
    transform: translateY(0);
}

.applications-handle {
    position: relative;
    z-index: 10;
    height: 44px;
    min-height: 44px;
    width: 100%;
    background: #666666;
    border: none;
    border-top: 1px solid #fff;
    border-bottom: 1px solid #fff;
    cursor: pointer;
    padding: 0 12px;
    flex-shrink: 0;
    transition: background 0.2s;
    pointer-events: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.applications-handle:hover {
    background: #CCCCCC;
}

.applications-handle:hover .applications-handle-arrow,
.applications-handle:hover .applications-handle-label {
    color: #333;
}

.applications-handle-arrow {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
    transition: transform 0.2s ease;
    transform: rotate(90deg);  /* point down when closed */
}

.applications.open .applications-handle-arrow {
    transform: rotate(-90deg);  /* point up when open */
}

.applications-handle-label {
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.95);
    user-select: none;
}

.applications-panel {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: calc(80vh - 44px);
    flex-shrink: 0;
    background: #eeeeee;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.applications.open .applications-handle {
    background: #CCCCCC;
}

.applications.open .applications-handle-arrow,
.applications.open .applications-handle-label {
    color: #333;
}

.tab-panel[data-panel="app"] .apps-panel__selection {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.tab-panel[data-panel="app"].apps-panel--detail .apps-panel__selection {
    display: none;
}

.tab-panel[data-panel="app"].apps-panel--detail #appSheetDetail {
    flex: 1 1 auto;
    min-height: 0;
}

.tab-panel[data-panel="app"] .apps-panel__icons-slot {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
}

.applications-apps {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 10px 0 8px;
    overflow: visible;
}

/* Wrapping grid — scales as more apps are added (max 5 columns). */
.applications-apps__row {
    --app-grid-max-cols: 5;
    --app-grid-col-max: 160px;
    --app-grid-col-min: 140px;
    --app-grid-gap-x: 48px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--app-grid-col-min), var(--app-grid-col-max)));
    justify-content: center;
    justify-items: center;
    align-items: start;
    gap: 32px var(--app-grid-gap-x);
    width: 100%;
    max-width: calc(
        var(--app-grid-max-cols) * var(--app-grid-col-max)
        + (var(--app-grid-max-cols) - 1) * var(--app-grid-gap-x)
    );
    margin-inline: auto;
}

/* Gumroad / embed: fill the detail view below the back row */
.tab-panel[data-panel="app"] .app-sheet-detail.app-sheet-detail--embed {
    flex: 1 1 0%;
    min-height: 0;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 160px;
    padding: 0;
    border: none;
    border-radius: 36px;
    background: transparent;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s ease;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    justify-self: center;
}

.app-item:hover {
    transform: scale(1.05);
}

.app-item .app-icon-frame {
    position: relative;
    display: block;
    overflow: hidden;
    width: 128px;
    height: 128px;
    border-radius: 28px;
    background: linear-gradient(145deg, #c8c8c8 0%, #a0a0a0 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.app-item .app-icon {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.app-item img.app-icon {
    object-fit: cover;
}

.app-item .app-icon-frame::after {
    content: '';
    position: absolute;
    inset: -20%;
    background: linear-gradient(
        105deg,
        transparent 22%,
        rgba(255, 255, 255, 0.2) 34%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0.2) 66%,
        transparent 78%
    );
    transform: translateX(-130%) skewX(-14deg);
    opacity: 0;
    pointer-events: none;
}

.app-item--sheen .app-icon-frame::after {
    opacity: 1;
    animation: app-icon-sheen 1.8s ease-in-out forwards;
}

@keyframes app-icon-sheen {
    from {
        transform: translateX(-130%) skewX(-14deg);
    }

    to {
        transform: translateX(130%) skewX(-14deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-item--sheen .app-icon-frame::after {
        animation: none;
        opacity: 0;
    }
}

/* Inert tiles that pad the app grid on the apps list screen */
.app-item--placeholder {
    pointer-events: none;
    cursor: default;
    opacity: 0;
}

.app-item--placeholder:hover {
    transform: none;
}

.app-item--placeholder.app-item--placeholder-wave,
.app-item--placeholder.app-item--placeholder-revealed {
    animation: app-placeholder-wave-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--placeholder-wave-delay, 0ms);
}

@keyframes app-placeholder-wave-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-item--placeholder {
        opacity: 1;
    }

    .app-item--placeholder.app-item--placeholder-wave,
    .app-item--placeholder.app-item--placeholder-revealed {
        animation: none;
    }
}

.app-item--placeholder .app-icon-frame {
    background: #e4e4e4;
    border: 2px solid rgba(0, 0, 0, 0.14);
    box-shadow: none;
}

.app-item--placeholder .app-icon-frame::after {
    display: none;
}

.app-item--placeholder .app-title {
    visibility: hidden;
    user-select: none;
}

.app-item .app-title {
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Phones: 3-column grid; also phone landscape (wide but short) */
@media (max-width: 768px), ((max-height: 480px) and (orientation: landscape)) {
    .tab-panel {
        padding: 16px 12px 20px;
    }

    .tab-panel[data-panel="app"] .apps-panel__selection {
        min-width: 0;
        overflow-x: clip;
    }

    .applications-apps {
        min-width: 0;
        width: 100%;
    }

    .applications-apps__row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px 8px;
        width: 100%;
        max-width: 100%;
        justify-items: center;
    }

    .app-item--placeholder .app-icon-frame {
        border-width: 2px;
    }

    .app-item {
        gap: 6px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        border-radius: 18px;
    }

    .app-item .app-icon-frame {
        width: min(100%, 64px);
        height: auto;
        aspect-ratio: 1;
        border-radius: 14px;
    }

    .app-item .app-title {
        font-size: 14px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-word;
    }
}

/* Empty state when Apps tab is open but no app detail is selected (#/apps) */
.apps-hub-hint {
    position: absolute;
    left: 50%;
    bottom: 28px;
    z-index: 2;
    width: min(calc(100% - 48px), 36rem);
    max-width: 36rem;
    margin: 0;
    padding: 22px 24px 24px;
    border-radius: 14px;
    background: linear-gradient(165deg, #fafafa 0%, #ececec 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
    opacity: 1;
    transform: translateX(-50%);
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.apps-hub-hint.apps-hub-hint--fade-out {
    opacity: 0;
    pointer-events: none;
}

.apps-hub-hint[hidden] {
    display: none !important;
}

.apps-hub-hint__kicker {
    margin: 0 0 8px;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #178a4a;
}

.apps-hub-hint__headline {
    margin: 0 0 12px;
    font-family: Arial, sans-serif;
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    font-weight: bold;
    line-height: 1.25;
    color: #222;
}

.apps-hub-hint__text {
    margin: 0;
    font-family: Arial, sans-serif;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.55;
    color: #555;
}

.tab-panel[data-panel="app"] .apps-hub-hint {
    text-align: center;
}

@media (max-width: 768px), ((max-height: 480px) and (orientation: landscape)) {
    .apps-hub-hint {
        bottom: 18px;
        width: min(calc(100% - 20px), 36rem);
        padding: 16px 18px 18px;
    }
}

@media (max-width: 768px) {
    .site-ribbon {
        left: 10px;
        max-height: min(78px, 14vh);
        max-width: min(calc(100vw - 10px), 740px);
    }

    .nav-block-item {
        padding: 0 14px;
        font-size: 14px;
    }

    .nav-block-item--app-detail {
        max-width: 7.5rem;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .site-ribbon {
        left: 8px;
        max-height: min(64px, 12vh);
        max-width: min(calc(100vw - 8px), 560px);
    }
}
