/* Keep the outer rails stable for application window bounds. */
.desktop-columns.frames-hidden {
  visibility: hidden;
  pointer-events: none;
}

.desktop-rail.rail-hidden {
  visibility: hidden;
  pointer-events: none;
}

.desktop-columns > .desktop-groups,
.desktop-columns > #desktop-groups-right.desktop-groups-right {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(342px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #a3b59542;
  border-radius: 0;
  background: #10221c55;
}

.desktop-columns > #desktop-groups-right.desktop-groups-right {
  left: auto;
  right: 0;
}

.rail-panels {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  min-height: 0;
  padding: 6px 8px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9aac8b70 transparent;
  scrollbar-gutter: stable;
}

.desktop-zone {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.desktop-zone-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 3px;
  color: #c0cdb6;
  font: 500 11px/18px "Segoe UI", Arial, sans-serif;
  letter-spacing: .025em;
}

.desktop-zone-title::after {
  content: '';
  flex: 1;
  border-top: 1px solid #ffffff20;
}

.desktop-zone[hidden],
.zone-controls[hidden] {
  display: none !important;
}

.desktop-rail-heading {
  display: flex;
  flex: 0 0 32px;
  align-items: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  min-width: 0;
  padding: 0 5px;
  border-bottom: 1px solid #ffffff20;
  background: #10221c70;
}

.rail-tabs {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.rail-tab {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  padding: 4px 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #b7c8ae;
  font: 500 11px/1.2 "Segoe UI", Arial, sans-serif;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 4px #0008;
}

.rail-tab[aria-pressed="true"] {
  border-color: #b4c79460;
  background: #b4c7941c;
  color: #e0ead5;
}

.rail-tab:hover {
  border-color: #b4c79440;
  background: #ffffff0c;
  color: #e0ead5;
}

.rail-tab:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.rail-zone-actions {
  display: flex;
  flex: 0 0 46px;
  align-items: center;
  min-width: 46px;
}

.zone-controls {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.zone-controls > button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 20px;
  padding: 3px;
  border: 1px solid #ffffff26;
  border-radius: 3px;
  background: #ffffff05;
  color: #c6d5bd;
}

.zone-controls svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zone-controls > button:hover:not(:disabled) {
  border-color: #bdcea872;
  background: #bdd1a526;
  color: #e4eedb;
}

.zone-controls > button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.zone-controls > button:disabled {
  border-color: transparent;
  background: transparent;
  opacity: .32;
  cursor: default;
}

.zone-panels {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
}

.desktop-zone .desktop-frame {
  width: 314px;
  max-width: 100%;
  padding: 3px;
  border-color: #b8caaa70;
  background: #14291f70;
  box-shadow: 0 1px 4px #0002;
}

.desktop-zone .desktop-frame:focus-within {
  border-color: #c0d3a7a6;
}

.desktop-zone .frame-heading {
  min-height: 18px;
}

.desktop-zone .frame-title {
  min-height: 18px;
  line-height: 18px;
}

.desktop-zone .frame-icons {
  grid-auto-columns: 96px;
  grid-template-rows: 84px;
  gap: 8px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.desktop-zone .frame-icons .desktop-icon {
  width: 96px;
  height: 84px;
  padding: 4px 2px;
  font-size: 11px;
  line-height: 1.35;
}

.desktop-zone .frame-icons .glyph {
  width: 50px;
  height: 40px;
  margin: 0 auto 4px;
}

.desktop-zone .frame-icons .desktop-icon > span:last-child:not(.glyph) {
  display: block;
  max-height: 30px;
  overflow: hidden;
}

.desktop-zone .desktop-frame.is-expanded .frame-icons {
  grid-template-columns: repeat(3, 96px);
  grid-template-rows: none;
  grid-auto-rows: 84px;
  max-height: none;
  overflow: visible;
}

footer :is(#toggle-left-frames, #toggle-right-frames) {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid #ffffff35;
  border-radius: 6px;
  background: #ffffff09;
  color: #bdcbb4;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

footer :is(#toggle-left-frames, #toggle-right-frames)[aria-pressed="true"] {
  border-color: #b4c79460;
  background: #b4c79418;
  color: #d4e0c7;
}

footer :is(#toggle-left-frames, #toggle-right-frames)[aria-pressed="false"] {
  border-color: #ffffff20;
  background: #ffffff03;
  color: #96a58d;
}

footer :is(#toggle-left-frames, #toggle-right-frames):hover {
  border-color: #ffffff55;
  background: #ffffff15;
  color: #d8e4c9;
}

footer :is(#toggle-left-frames, #toggle-right-frames):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

footer :is(#toggle-left-frames, #toggle-right-frames) > svg {
  display: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 740px) {
  /* Both complete category lists use the desktop's outer mobile scroll area. */
  .desktop-columns {
    gap: 16px;
  }

  .desktop-columns > .desktop-groups,
  .desktop-columns > #desktop-groups-right.desktop-groups-right {
    position: static;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: min(342px, 100%);
    height: auto;
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  .desktop-columns > :is(#desktop-groups, #desktop-groups-right).rail-hidden {
    display: none;
  }

  .desktop-zone {
    flex: 0 0 auto;
    overflow: visible;
  }

  .rail-panels {
    flex: 0 0 auto;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }
}

@media (max-width: 700px) {
  footer :is(#toggle-left-frames, #toggle-right-frames) {
    height: 25px;
    padding: 4px 6px;
    font-size: 10px;
  }
}

@media (max-width: 560px) {
  footer :is(#toggle-left-frames, #toggle-right-frames) {
    width: 28px;
    padding: 4px;
  }

  footer :is(#toggle-left-frames, #toggle-right-frames) > svg {
    display: block;
  }

  footer :is(#toggle-left-frames, #toggle-right-frames) > span {
    display: none;
  }
}

@media (max-width: 360px) {
  footer :is(#toggle-left-frames, #toggle-right-frames) {
    width: 26px;
  }

  .desktop-zone .frame-icons {
    grid-auto-columns: calc((100% - 16px) / 3);
  }

  .desktop-zone .frame-icons .desktop-icon {
    width: 100%;
    font-size: 10.5px;
  }

  .desktop-zone .desktop-frame.is-expanded .frame-icons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  footer :is(#toggle-left-frames, #toggle-right-frames) {
    transition: none;
  }
}
